Writing HTML Markup

Understanding HTML Structure

HTML (HyperText Markup Language) is the fundamental building block of web pages. A well-structured HTML document provides a solid foundation for creating responsive designs.

Key Elements for Responsive Design

  • <html>: The root element of an HTML document.
  • <head>: Contains meta information about the page, such as the title and stylesheet links.
  • <body>: Contains the visible content of the page, including text, images, and other elements.
  • <header>: Defines the header section of the page, often containing the logo, navigation menu, and search bar.
  • <main>: Represents the main content of the page.
  • <section>: Defines a thematic grouping of content.
  • <article>: Represents an independent item of content, such as a blog post or news article.
  • <aside>: Defines content that is tangentially related to the main content.
  • <footer>: Defines the footer section of the page, often containing copyright information, contact details, and links to social media.

Best Practices for Responsive HTML

  • Semantic HTML: Use appropriate HTML elements to convey the meaning of your content.
  • Logical Structure: Organize your content in a logical and hierarchical structure.
  • Avoid Inline Styles: Use external stylesheets to separate content from presentation.
  • Accessibility: Ensure your HTML is accessible to users with disabilities by following accessibility guidelines (e.g., ARIA attributes, alternative text for images).
  • Mobile-First Approach: Design for mobile devices first and progressively enhance for larger screens.

Code Example (Basic Structure)

<!DOCTYPE html>

<html>

<head>

  <title>My Responsive Website</title>

  <link rel=”stylesheet” href=”styles.css”>

</head>

<body>

  <header>

    <h1>My Website</h1>

    <nav>

      <ul>

        <li><a href=”#”>Home</a></li>

        <li><a href=”#”>About</a></li>

        <li><a href=”#”>Contact</a></li>

      </ul>

    </nav>

  </header>

  <main>

    <section> 

      <h2>Welcome</h2>

      <p>This is the main content of my website.</p>

    </section>

  </main>

  <footer>

    <p>&copy; 2023 My Website</p>

  </footer>

</body>

</html>

By following these guidelines and using appropriate HTML elements, you can create a solid foundation for your responsive web design. Remember to combine your HTML structure with CSS styles to achieve the desired layout and visual effects.

Enter media queries | The Fundamentals of Responsive Web Design
Starting HTML pages correctly | Writing HTML Markup

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?