HTML Basics

HTML Introduction HTML Basic HTML Comments HTML Tags/Elements HTML Attributes HTML Formatting HTML Block and Inline HTML Charsets HTML Classes HTML Colors HTML Div HTML Headings HTML Id HTML Iframes HTML Images HTML File Paths HTML Tables HTML Layout HTML Lists HTML Links <a> HTML Paragraphs HTML Quotations HTML JavaScript HTML Emojis HTML URL Encode HTML Entities HTML Computercode HTML Symbols HTML Styles

HTML Forms

HTML Forms HTML Form Elements HTML Form Attributes HTML Input Attributes HTML Input Regex HTML Input Form Attributes HTML Input Types

HTML SEO

HTML Head HTML Page Title HTML Responsive HTML Semantics HTML Favicon

HTML Graphics

HTML Canvas HTML SVG

HTML Media

HTML Media HTML Audio HTML Video

HTML Reference

a abbr acronym address applet area article aside audio b base basefont bdi bdo big blockquote body br button canvas caption center cite code col colgroup data datalist dd del details dfn dialog dir div dl DOCTYPE dt em embed fieldset figcaption figure font footer form frame frameset h1_-_h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noframes noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script search section select small source span strike strong style sub summary sup svg table tbody td template textarea tfoot th thead time title tr track tt u ul var video wbr

Introduction to HTML Layout

HTML layout refers to how elements on a web page are structured and positioned. It involves organizing content in a way that is visually appealing and easy to navigate for users.

Using the div Tag for Layout

The div tag is a versatile container that can be used to group and style elements on a web page. By using CSS, we can control the layout and positioning of div elements to create a unique page design.

<div id="header">
   <h1>Welcome to our Website</h1>
</div>

<div id="content">
   <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>

<div id="footer">
   <p>© 2022 All rights reserved.</p>
</div>

Using CSS to Style Layouts

CSS (Cascading Style Sheets) is used to style HTML elements and control their appearance on a web page. By applying CSS rules to div elements, we can customize the layout, colors, fonts, and spacing of our content.

#header {
   background-color: #333;
   color: #fff;
   text-align: center;
   padding: 10px;
}

#content {
   margin: 20px;
}

#footer {
   background-color: #333;
   color: #fff;
   text-align: center;
   padding: 10px;
}

4. Creating Responsive Layouts

Responsive design is important for ensuring that your web page looks good on all devices, including desktops, tablets, and smartphones. Using CSS media queries, we can adjust the layout of our page based on screen size.

@media only screen and (max-width: 600px) {
   #content {
      margin: 10px;
   }
}

5. Summary

Congratulations! You have learned the basics of HTML layout and how to create structured and visually appealing web pages. By using div elements and CSS, you can customize the layout of your content and create a unique user experience.