W3.CSS Tutorial
Selected Reading
- W3.CSS - Discussion
- W3.CSS - Useful Resources
- W3.CSS - Quick Guide
- W3.CSS - Utilities
- W3.CSS - Navigation
- W3.CSS - Colors
- W3.CSS - Icons
- W3.CSS - Images
- W3.CSS - Lists
- W3.CSS - Tables
- W3.CSS - Modal Dialog
- W3.CSS - Tooltips
- W3.CSS - Buttons
- W3.CSS - Forms
- W3.CSS - Grids
- W3.CSS - Responsive Design
- W3.CSS - Cards
- W3.CSS - Code Coloring
- W3.CSS - Containers
- W3.CSS - Environment Setup
- W3.CSS - Overview
- W3.CSS - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
W3.CSS - Containers
W3.CSS - Containers
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.
W3.CSS also provides containers with hide/close capabipty. See the following example −
w3css_hide_container.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> <span class = "w3-container w3-border w3-teal"> <span class = "w3-closebtn" oncpck = "this.parentElement.style.display = none ">X</span> <p>Close container by cpcking on the X in the upper right corner.</p> </span> </body> </html>
Result
Verify the result.
Advertisements