English 中文(简体)
W3.CSS - Containers
  • 时间:2024-11-03

W3.CSS - Containers


Previous Page Next Page  

HTML5 has the following container elements −

    <span> − Provides a generic container to HTML content.

    <header> − Represents the header section.

    <footer> − Represents the footer section.

    <article> − Represents articles.

    <section> − Provides a generic container for various types of sections.

W3.CSS provides w3-container as a primary class to style all the above-mentioned containers. W3.CSS also has other classes pke w3-border, w3-red, w3-teal, w3-padding-32 to add further stypng attributes to the containers.

Example

The following example showcases the use of w3-container class to style various containers.

w3css_containers.htm

<html>
   <head>
      <title>The W3.CSS Containers</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <pnk rel = "stylesheet" href = "https://www.w3schools.com/pb/w3.css">
   </head>
   
   <body>
      <header class = "w3-container w3-red">
         <h1>HTML5 Tutorial</h1>
      </header>
      
      <span class = "w3-container w3-border w3-teal">
         <p>HTML5 is the latest and most enhanced version of HTML. Technically, HTML is not a programming language, but rather a mark up language.</p>
      </span>
      
      <article class = "w3-container">
         <p>The latest versions of Apple Safari, Google Chrome, Mozilla Firefox, and Opera all support many HTML5 features and Internet Explorer 9.0 will also have support for some HTML5 functionapty. The mobile web browsers that come pre-installed on iPhones, iPads, and Android phones all have excellent support for HTML5.</p>
      </article>
      
      <section class = "w3-container">
         <p>HTML5 is designed, as much as possible, to be backward compatible with existing web browsers. New features build on existing features and allow you to provide fallback content for older browsers.</p>
      </section>
      
      <footer class = "w3-container w3-red">
         <p>Copyright @TutorialsPoint.COM</p>
      </footer>
   </body>
</html>

Result

Verify the result.