Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • CSS Tutorial
  • CSS Exercises
  • CSS Interview Questions
  • CSS Selectors
  • CSS Properties
  • CSS Functions
  • CSS Examples
  • CSS Cheat Sheet
  • CSS Templates
  • CSS Frameworks
  • Bootstrap
  • Tailwind
  • CSS Formatter
Open In App
Next Article:
W3.CSS Tags
Next article icon

W3.CSS Lists

Last Updated : 02 Mar, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

Lists are very useful in a webpage. It can be used a variety of content as they are flexible and easy to manage. We use .w3-ul class for the list. The default style for the list is borderless but we can use other classes to add a border and other effects to the list.

Example: Adding a list on a webpage using W3.CSS.

HTML




<!DOCTYPE html>
<html>
  
<head>
  
    <!-- Adding W3.CSS file through external link -->
    <link rel="stylesheet" href=
        "https://www.w3schools.com/w3css/4/w3.css">
</head>
  
<body>
    <!-- w3-container is used to add
         16px padding to any HTML element.  -->
    <!-- w3-center is used to set the 
         content of the element to the center. -->
    <div class="w3-container w3-center">
  
        <!-- w3-text-green sets 
             the text color to green. -->
        <!-- w3-xxlarge sets font size to 32px. -->
        <h2 class="w3-text-green w3-xxlarge">
           Welcome To GFG
        </h2>
    </div>
      
    <!-- Adding a List on a page -->
    <div class="w3-container">
        <!-- List -->
        <ul class="w3-ul"> 
            <!-- List Content -->
            <li>Data Structure</li> 
            <li>Operating System</li> 
            <li>Algorithm</li> 
        </ul>
    </div>
</body>
  
</html>
 
 

Output:

We can also add borders by using w3-border class in W3.CSS.

Example: Adding a list with border on a webpage using W3.CSS.

HTML




<!DOCTYPE html>
<html>
  
<head>
  
    <!-- Adding W3.CSS file through external link -->
    <link rel="stylesheet" href=
        "https://www.w3schools.com/w3css/4/w3.css">
</head>
  
<body>
    <!-- w3-container is used to add 16px
         padding to any HTML element.  -->
    <!-- w3-center is used to set the 
         content of the element to the center. -->
    <div class="w3-container w3-center">
  
        <!-- w3-text-green sets the text color to green. -->
        <!-- w3-xxlarge sets font size to 32px. -->
        <h2 class="w3-text-green w3-xxlarge">
            Welcome To GFG
        </h2>
    </div>
      
    <!-- Adding a List on a page -->
    <div class="w3-container">
        <!-- List -->
        <!-- Adding Border to the list
             with some border radius -->
        <ul class="w3-ul w3-border w3-round"> 
            <!-- List Content -->
            <li>Data Structure</li> 
            <li>Operating System</li> 
            <li>Algorithm</li> 
        </ul>
    </div>
</body>
  
</html>
 
 

Output:

We can also add colors to the list by using w3-colour classes. These color can also be from hoverable class to add a hover effect on the list.

Example: Adding a list with colors on a webpage using W3.CSS.

HTML




<!DOCTYPE html>
<html>
  
<head>
  
    <!-- Adding W3.CSS file through external link -->
    <link rel="stylesheet" href=
        "https://www.w3schools.com/w3css/4/w3.css">
</head>
  
<body>
    <!-- w3-container is used to add 16px padding 
         to any HTML element.  -->
    <!-- w3-center is used to set the content of 
         the element to the center. -->
    <div class="w3-container w3-center">
        <!-- w3-text-green sets the text color to green. -->
        <!-- w3-xxlarge sets font size to 32px. -->
        <h2 class="w3-text-green w3-xxlarge">
            Welcome To GFG
        </h2>
    </div>
      
    <!-- Adding a List on a page -->
    <div class="w3-container">
        <!-- List -->
        <!-- Adding Colors to the list -->
        <ul class="w3-ul"> 
            <!-- List Content -->
            <li class="w3-pale-blue">Data Structure</li> 
            <li class="w3-pale-red">Operating System</li> 
            <li class="w3-pale-yellow">Algorithm</li> 
        </ul>
    </div>
</body>
  
</html>
 
 

Output:

We can even change the width of the list using basic CSS or style. List have the width set to 100% by default.

Syntax:

<div style="width: x%">...</div>

Example:

HTML




<!DOCTYPE html>
<html>
  
<head>
  
    <!-- Adding W3.CSS file through external link -->
    <link rel="stylesheet" href=
        "https://www.w3schools.com/w3css/4/w3.css">
</head>
  
<body>
    <!-- w3-container is used to add 16px padding 
         to any HTML element.  -->
    <!-- w3-center is used to set the content of 
         the element to the center. -->
    <div class="w3-container w3-center">
        <!-- w3-text-green sets the text color to green. -->
        <!-- w3-xxlarge sets font size to 32px. -->
        <h2 class="w3-text-green w3-xxlarge">
            Welcome To GFG
        </h2>
    </div>
      
    <!-- Adding a List on a page -->
    <div class="w3-container">
        <!-- List -->
        <!-- Setting width of the list to 50% -->
        <ul class="w3-ul" style="width:50%;"> 
            <!-- List Content -->
            <li class="w3-pale-blue">Data Structure</li> 
            <li class="w3-pale-red">Operating System</li> 
            <li class="w3-pale-yellow">Algorithm</li> 
        </ul>
    </div>
</body>
  
</html>
 
 

Output:

Lists also come with various sizes. You can set the size of the list from various size classes in W3.CSS.

Example:

HTML




<!DOCTYPE html>
<html>
  
<head>
  
    <!-- Adding W3.CSS file through external link -->
    <link rel="stylesheet" href=
        "https://www.w3schools.com/w3css/4/w3.css">
</head>
  
<body>
    <!-- w3-container is used to add 16px padding 
         to any HTML element.  -->
    <!-- w3-center is used to set the content of 
         the element to the center. -->
    <div class="w3-container w3-center">
        <!-- w3-text-green sets the text color to green. -->
        <!-- w3-xxlarge sets font size to 32px. -->
        <h2 class="w3-text-green w3-xxlarge">
            Welcome To GFG
        </h2>
    </div>
      
    <!-- Adding a List on a page -->
    <div class="w3-container">
        <!-- List -->
        <!-- List with various sizes -->
        <ul class="w3-ul"> 
            <!-- List Content -->
            <li class="w3-pale-blue w3-small">
                Small Sized List
            </li> 
            <li class="w3-pale-red w3-large">
                Large Sized List
            </li> 
            <li class="w3-pale-yellow w3-jumbo">
                Jumbo Sized List
            </li> 
        </ul>
    </div>
</body>
  
</html>
 
 

Output:

You can also add badges in the list. To add a badge you can use w3-badge class.

Example:

HTML




<!DOCTYPE html>
<html>
  
<head>
  
    <!-- Adding W3.CSS file through external link -->
    <link rel="stylesheet" href=
        "https://www.w3schools.com/w3css/4/w3.css">
</head>
  
<body>
    <!-- w3-container is used to add 16px padding 
         to any HTML element.  -->
    <!-- w3-center is used to set the content of 
         the element to the center. -->
    <div class="w3-container w3-center">
  
        <!-- w3-text-green sets the text color to green. -->
        <!-- w3-xxlarge sets font size to 32px. -->
        <h2 class="w3-text-green w3-xxlarge">
            Welcome To GFG
        </h2>
    </div>
      
    <!-- Adding a List on a page -->
    <div class="w3-container">
        <!-- List -->
        <!-- Adding Badges with the content 
             in the List -->
        <ul class="w3-ul"> 
            <!-- List Content -->
            <li class="w3-pale-blue">
                Data Structure <span class=
                "w3-badge w3-blue">1</span>
            </li> 
            <li class="w3-pale-red">
                Operating System <span class=
                "w3-badge w3-pink">5</span>
            </li> 
            <li class="w3-pale-yellow">
                Algorithm <span class=
                "w3-badge w3-yellow">0</span>
            </li> 
        </ul>
    </div>
</body>
  
</html>
 
 

Output:



Next Article
W3.CSS Tags
author
aditya_taparia
Improve
Article Tags :
  • CSS
  • Web Technologies
  • W3.CSS

Similar Reads

  • CSS Lists
    CSS Lists are used to display items in a clear and organized manner, either with bullets (unordered) or numbers (ordered). They help keep content neat and structured on a webpage. With CSS, you can customize the look of lists to improve the design and layout of your content. Try It: .custom-item { b
    5 min read
  • W3.CSS Tags
    The .w3-tag is used to add additional information to the content. For example, some website highlights some sections to be new or when they have updated a section they add updated tag with that division so that user can see that they have updated to added new divisions on their site. This class when
    4 min read
  • W3.CSS Tables
    W3.CSS provides a series of classes that can be used to apply various styling to the tables such as changing the heading appearance, making the rows stripped, adding or removing borders, making rows hoverable, etc. W3.CSS also provides classes for making tables responsive. Simple Table: The .w3-tabl
    7 min read
  • W3.CSS Cards
    A card is a flexible and extensible content container. It can include header, footer and a wide variety of content. W3.CSS helps the developers to add paper-like effects to the elements. It contains three types of classes: Sr. No. Class Name Description 1. w3-card It is used to add a box shadow of 2
    3 min read
  • W3.CSS Margin
    W3.CSS has many facilities of classes to easily style elements in HTML. It includes various responsive margin classes for modification of the appearance of the element. The list of margin classes are as follows: Sr. No. Class Name Description 1. w3-margin It adds 16px of margin to all the sides of t
    2 min read
  • W3.CSS Colors
    W3.CSS provides us with classes to set the color of font and container. Not only this, there are also classes to change or set the color of the font or container on hover the division or section. All the coloring elements can be broadly be classified into the following parts: Background ColorText Co
    6 min read
  • W3.CSS Padding
    W3.CSS has many facilities of classes to easily style elements in HTML. It includes various responsive padding classes for modification of the appearance of the element. There are two types of padding classes: Numbered Padding ClassesSized Padding Classes Numbered Padding Classes: These classes add
    3 min read
  • W3.CSS Code
    W3.CSS provides several classes for displaying inline and multiline blocks of code. Displaying Inline Code: Inline code should be wrapped in <code> tags with w3-codespan as the class. The resulting text will be displayed in a fixed-width font and given a red font color with a light grey backgr
    2 min read
  • W3.CSS Introduction
    What is W3.CSS?W3.CSS is a modern framework with built-in responsiveness and easy to learn and use compared to other CSS frameworks.It aims to speed up and simplify web development and support modern responsive devices like Mobile, Laptop, Tablet and Desktop.W3.CSS was designed to be a high-quality
    2 min read
  • What is CSS Ruleset?
    A CSS ruleset is the foundation of how styles are applied to HTML elements on a web page. It consists of a selector and one or more declarations, which define how elements are displayed.A CSS ruleset is made up of a selector and declarations.The selector targets HTML elements to apply styles.Declara
    10 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences