Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-3-7-sonnet-20250219· AnthropicHugging Face LMArena Human Preference 140K

freate a good looking website for calory tracking using html css and js in one file , it…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with chatgpt-4o-latest-20250326’s answer.
  1. User

    freate a good looking website for calory tracking using html css and js in one file , it should be looking comfy and inviting to use

  2. Claude Assistant

    Here's a simple, comfy calorie tracking website in a single HTML file with embedded CSS and JavaScript:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Comfy Calorie Tracker</title>
        <style>
            :root {
                --primary: #7c9a92;
                --secondary: #f4f1de;
                --accent: #e07a5f;
                --text: #3d405b;
                --light: #f8f9fa;
            }
            
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
                font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            }
            
            body {
                background-color: var(--secondary);
                color: var(--text);
                line-height: 1.6;
                padding: 20px;
            }
            
            .container {
                max-width: 800px;
                margin: 0 auto;
                background-color: var(--light);
                padding: 30px;
                border-radius: 15px;
                box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            }
            
            h1 {
                color: var(--primary);
                text-align: center;
                margin-bottom: 20px;
                font-size: 2.5rem;
            }
            
            .subtitle {
                text-align: center;
                margin-bottom: 30px;
                color: var(--text);
                font-weight: normal;
            }
            
            .card {
                background-color: white;
                border-radius: 10px;
                padding: 20px;
                margin-bottom: 20px;
                box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
            }
            
            .form-group {
                margin-bottom: 15px;
            }
            
            label {
                display: block;
                margin-bottom: 5px;
                font-weight: 500;
            }
            
            input, select {
                width: 100%;
                padding: 10px;
                border: 1px solid #ddd;
                border-radius: 8px;
                font-size: 1rem;
            }
            
            button {
                background-color: var(--primary);
                color: white;
                border: none;
                padding: 12px 20px;
                border-radius: 8px;
                cursor: pointer;
                font-size: 1rem;
                transition: all 0.3s ease;
                width: 100%;
            }
            
            button:hover {
                background-color: #6a8a82;
                transform: translateY(-2px);
            }
            
            .summary {
                display: flex;
                justify-content: space-between;
                margin-top: 20px;
                padding: 15px;
                background-color: var(--primary);
                color: white;
                border-radius: 8px;
            }
            
            .summary-item {
                text-align: center;
            }
            
            .summary-value {
                font-size: 1.5rem;
                font-weight: bold;
            }
            
            table {
                width: 100%;
                border-collapse: collapse;
                margin-top: 20px;
            }
            
            th, td {
                padding: 12px;
                text-align: left;
                border-bottom: 1px solid #ddd;
            }
            
            th {
                background-color: var(--primary);
                color: white;
            }
            
            tr:hover {
                background-color: #f5f5f5;
            }
            
            .delete-btn {
                background-color: var(--accent);
                color: white;
                border: none;
                padding: 5px 10px;
                border-radius: 5px;
                cursor: pointer;
            }
            
            .delete-btn:hover {
                background-color: #d06a4f;
            }
            
            .empty-state {
                text-align: center;
                padding: 30px;
                color: #888;
            }
            
            .date-display {
                text-align: center;
                font-size: 1.2rem;
                margin-bottom: 20px;
                color: var(--primary);
                font-weight: 500;
            }
            
            @media (max-width: 600px) {
                .container {
                    padding: 15px;
                }
                
                .summary {
                    flex-direction: column;
                    gap: 10px;
                }
            }
        </style>
    </head>
    <body>
        <div class="container">
            <h1>Comfy Calorie Tracker</h1>
            <h3 class="subtitle">Track your meals with ease and comfort</h3>
            
            <div class="date-display" id="currentDate"></div>
            
            <div class="card">
                <form id="food-form">
                    <div class="form-group">
                        <label for="food-name">Food Name</label>
                        <input type="text" id="food-name" placeholder="What did you eat?" required>
                    </div>
                    
                    <div class="form-group">
                        <label for="calories">Calories</label>
                        <input type="number" id="calories" placeholder="How many calories?" required>
                    </div>
                    
                    <div class="form-group">
                        <label for="meal-type">Meal Type</label>
                        <select id="meal-type" required>
                            <option value="breakfast">Breakfast</option>
                            <option value="lunch">Lunch</option>
                            <option value="dinner">Dinner</option>
                            <option value="snack">Snack</option>
                        </select>
                    </div>
                    
                    <button type="submit">Add Food</button>
                </form>
            </div>
            
            <div class="card">
                <h2>Today's Summary</h2>
                <div class="summary">
                    <div class="summary-item">
                        <div>Total Calories</div>
                        <div class="summary-value" id="total-calories">0</div>
                    </div>
                    <div class="summary-item">
                        <div>Meals</div>
                        <div class="summary-value" id="meal-count">0</div>
                    </div>
                    <div class="summary-item">
                        <div>Goal</div>
                        <div class="summary-value" id="calorie-goal">2000</div>
                    </div>
                </div>
            </div>
            
            <div class="card">
                <h2>Today's Food Log</h2>
                <div id="food-list">
                    <div class="empty-state" id="empty-state">
                        <p>No foods logged today. Add your first meal above!</p>
                    </div>
                    <table id="food-table" style="display: none;">
                        <thead>
                            <tr>
                                <th>Food</th>
                                <th>Meal</th>
                                <th>Calories</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody id="food-table-body">
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    
        <script>
            // Initialize data
            let foods = JSON.parse(localStorage.getItem('foods')) || [];
            const calorieGoal = 2000;
            
            // DOM elements
            const foodForm = document.getElementById('food-form');
            const foodNameInput = document.getElementById('food-name');
            const caloriesInput = document.getElementById('calories');
            const mealTypeInput = document.getElementById('meal-type');
            const totalCaloriesEl = document.getElementById('total-calories');
            const mealCountEl = document.getElementById('meal-count');
            const calorieGoalEl = document.getElementById('calorie-goal');
            const foodTableBody = document.getElementById('food-table-body');
            const foodTable = document.getElementById('food-table');
            const emptyState = document.getElementById('empty-state');
            const currentDateEl = document.getElementById('currentDate');
            
            // Display current date
            function updateDate() {
                const now = new Date();
                const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
                currentDateEl.textContent = now.toLocaleDateString('en-US', options);
            }
            
            // Add food to the list
            function addFood(e) {
                e.preventDefault();
                
                const foodName = foodNameInput.value;
                const calories = parseInt(caloriesInput.value);
                const mealType = mealTypeInput.value;
                
                const newFood = {
                    id: Date.now(),
                    name: foodName,
                    calories: calories,
                    mealType: mealType,
                    date: new Date().toISOString().split('T')[0]
                };
                
                foods.push(newFood);
                updateFoodList();
                updateSummary();
                saveFoods();
                
                // Reset form
                foodForm.reset();
                foodNameInput.focus();
            }
            
            // Update the food list display
            function updateFoodList() {
                const today = new Date().toISOString().split('T')[0];
                const todaysFoods = foods.filter(food => food.date === today);
                
                if (todaysFoods.length === 0) {
                    foodTable.style.display = 'none';
                    emptyState.style.display = 'block';
                    return;
                }
                
                foodTable.style.display = 'table';
                emptyState.style.display = 'none';
                
                foodTableBody.innerHTML = '';
                
                todaysFoods.forEach(food => {
                    const row = document.createElement('tr');
                    
                    // Capitalize first letter of meal type
                    const mealTypeFormatted = food.mealType.charAt(0).toUpperCase() + food.mealType.slice(1);
                    
                    row.innerHTML = `
                        <td>${food.name}</td>
                        <td>${mealTypeFormatted}</td>
                        <td>${food.calories}</td>
                        <td><button class="delete-btn" data-id="${food.id}">Delete</button></td>
                    `;
                    
                    foodTableBody.appendChild(row);
                });
            }
            
            // Update the summary section
            function updateSummary() {
                const today = new Date().toISOString().split('T')[0];
                const todaysFoods = foods.filter(food => food.date === today);
                
                const totalCalories = todaysFoods.reduce((total, food) => total + food.calories, 0);
                const mealCount = todaysFoods.length;
                
                totalCaloriesEl.textContent = totalCalories;
                mealCountEl.textContent = mealCount;
                calorieGoalEl.textContent = calorieGoal;
                
                // Change color based on calorie goal
                if (totalCalories > calorieGoal) {
                    totalCaloriesEl.style.color = '#ff6b6b';
                } else {
                    totalCaloriesEl.style.color = 'white';
                }
            }
            
            // Delete a food item
            function deleteFood(e) {
                if (e.target.classList.contains('delete-btn')) {
                    const id = parseInt(e.target.getAttribute('data-id'));
                    foods = foods.filter(food => food.id !== id);
                    
                    updateFoodList();
                    updateSummary();
                    saveFoods();
                }
            }
            
            // Save foods to localStorage
            function saveFoods() {
                localStorage.setItem('foods', JSON.stringify(foods));
            }
            
            // Event listeners
            foodForm.addEventListener('submit', addFood);
            document.addEventListener('click', deleteFood);
            
            // Initialize
            updateDate();
            updateFoodList();
            updateSummary();
        </script>
    </body>
    </html>
    

    Would you like me to explain or break down the code?

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.