DEV Community

Jayden Imel
Jayden Imel

Posted on

HTML website code

<!DOCTYPE html>




MLB Teams - Dodgers & Cubs body { font-family: Arial, sans-serif; margin: 0; padding: 0; background-color: #f4f4f4; color: #333; } header { background-color: #0d47a1; color: white; padding: 20px; text-align: center; } nav ul { list-style: none; padding: 0; } nav ul li { display: inline-block; margin: 0 15px; } nav ul li a { color: white; text-decoration: none; font-weight: bold; } section { padding: 40px; text-align: center; border-bottom: 1px solid #ddd; transition: background-color 0.3s; } #dodgers { background-color: #e6f0ff; } #cubs { background-color: #ffe6e6; } .team-logo { width: 150px; height: auto; margin: 20px 0; } button { padding: 10px 20px; background-color: #0d47a1; color: white; border: none; border-radius: 5px; cursor: pointer; margin-top: 10px; } button:hover { background-color: #1565c0; } .tabs { margin: 20px 0; } .tab-button { padding: 10px 15px; margin: 0 5px; cursor: pointer; border: 1px solid #0d47a1; background-color: white; border-radius: 5px; } .tab-button.active { background-color: #0d47a1; color: white; } .tab-content { display: none; margin-top: 20px; } .tab-content.active { display: block; } .team-link { display: block; margin-top: 15px; font-weight: bold; color: #0d47a1; text-decoration: underline; } footer { text-align: center; padding: 20px; background-color: #0d47a1; color: white; }
<h1>MLB Teams</h1>

    <ul>
        <li><a href="#dodgers">LA Dodgers</a></li>
        <li><a href="#cubs">Chicago Cubs</a></li>
    </ul>




<h2>Los Angeles Dodgers</h2>
<img src="https://upload.wikimedia.org/wikipedia/en/0/0e/Los_Angeles_Dodgers_Logo.svg" alt="Dodgers Logo">
<p>The Los Angeles Dodgers are a professional baseball team based in Los Angeles, California. They compete in MLB's National League West division.</p>
<a href="https://www.mlb.com/dodgers">Visit Official Dodgers Website</a>
Cheer for Dodgers!
<p id="dodgers-cheers">Cheers: 0</p>


    Roster
    Schedule
    News



    <ul>
        <li>Mookie Betts</li>
        <li>Freddie Freeman</li>
        <li>Clayton Kershaw</li>
    </ul>


    <ul>
        <li>Oct 10: vs Giants</li>
        <li>Oct 12: vs Padres</li>
        <li>Oct 15: vs Rockies</li>
    </ul>


    <p>Dodgers sign new rookie pitcher for the 2026 season!</p>




<h2>Chicago Cubs</h2>
<img src="https://upload.wikimedia.org/wikipedia/commons/8/82/Chicago_Cubs_Logo.svg" alt="Cubs Logo">
<p>The Chicago Cubs are a professional baseball team based in Chicago, Illinois. They compete in MLB's National League Central division.</p>
<a href="https://www.mlb.com/cubs">Visit Official Cubs Website</a>
Cheer for Cubs!
<p id="cubs-cheers">Cheers: 0</p>


    Roster
    Schedule
    News



    <ul>
        <li>Seiya Suzuki</li>
        <li>Javier Báez</li>
        <li>Marcus Stroman</li>
    </ul>


    <ul>
        <li>Oct 11: vs Cardinals</li>
        <li>Oct 13: vs Brewers</li>
        <li>Oct 16: vs Reds</li>
    </ul>


    <p>Cubs announce summer training camp with new coaching staff.</p>




<p>© 2025 MLB Fan Page</p>
Enter fullscreen mode Exit fullscreen mode

let cheers = { Dodgers: 0, Cubs: 0 };

function cheer(team) {
cheers[team]++;
document.getElementById(${team.toLowerCase()}-cheers).innerText = Cheers: ${cheers[team]};
alert(Go ${team}! ⚾🎉);
}

function openTab(team, tab, btn) {
const sections = ['roster','schedule','news'];
sections.forEach(s => {
document.getElementById(${team}-${s}).classList.remove('active');
});
document.getElementById(${team}-${tab}).classList.add('active');

// Update button active state
btn.parentElement.querySelectorAll('.tab-button').forEach(b =&gt; b.classList.remove('active'));
btn.classList.add('active');
Enter fullscreen mode Exit fullscreen mode

}

Top comments (0)