VOOZH about

URL: https://www.geeksforgeeks.org/css/w3-css-containers-and-panels/

⇱ W3.CSS Containers and Panels - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

W3.CSS Containers and Panels

Last Updated : 30 Sep, 2022

W3.CSS provides web developers with the two most useful classes i.e. container and panels. They are used to place content together with same font-color, background-color, font-size, font-family, etc.

w3-container: This class is used to add 16px padding on both the left and right side of the element. It can be used with all the HTML5 container elements i.e. div, article, section, header, footer, etc. All the elements inside this class share the same font-size, font-color, padding, alignment, etc.

Example: Using the w3-container class in the HTML page.

Output:

👁 Image
w3-panel: This class adds 16px padding on all sides i.e. top, right, bottom, left. It can also be used with all the HTML5 container elements i.e. div, article, section, header, footer, etc. All the elements inside this class share the same font-size, font-color, padding, alignment, etc.

Example: Using the w3-panel class in the HTML page.

Output:

👁 Image

You can see that the gap between heading and paragraph is increased because we have w3-panel class.

Note:

  • If you use paragraph tag then automatically padding is added between the content and the division.
  • You can use panels and containers to make styles like notes, quotes, alerts, cards and many more.
Comment
Article Tags:
Article Tags: