DEV Community

Cover image for My Journey Learning CSS - Styling Lists, Creating Navbars, and Understanding Overflow🚀 (Day-13)
Angshuman
Angshuman

Posted on

1

My Journey Learning CSS - Styling Lists, Creating Navbars, and Understanding Overflow🚀 (Day-13)

CSS is an essential part of web development, allowing us to design and structure our web pages effectively. Today, we’re going to dive into three fundamental CSS concepts: styling lists, creating a navigation bar using lists, and managing content overflow. Let’s break them down one by one!

đź“Š Styling Lists in CSS

Lists are a common HTML element used for menus, navigation, and content organization. CSS provides several ways to style lists to make them visually appealing.

Key Properties for Styling Lists

list-style-type – Controls the appearance of the list marker.

disc (default)

circle

square

none (removes the marker)

list-style-position – Determines where the marker appears.

inside (marker is inside the content)

outside (marker is outside the content)

list-style – A shorthand property to set both list-style-type and list-style-position together.

Example: Styling an Unordered List

ul {
    list-style-type: square;
    list-style-position: inside;
    color: #333;
    font-size: 18px;
}
Enter fullscreen mode Exit fullscreen mode

This will style an unordered list with square markers inside the content, making it look neat and professional.

đź“Š Creating a Navigation Bar Using Lists

Navigation bars are a crucial part of any website, and lists (<ul> and <li>) are commonly used to structure them. Using CSS, we can transform a simple list into a stylish and functional navbar.

Steps to Create a Simple Navbar

Remove default list styles using list-style: none;.

Display list items inline to create a horizontal layout.

Add padding, margins, and background colors for styling.

Image description

đź“Š Understanding the CSS Overflow Property

The overflow property in CSS helps control how content behaves when it exceeds its container. Without proper handling, overflowing content can break layouts and cause unwanted scrolling.

Common overflow Values

visible (default) – Content spills out of its container.

hidden – Clips any overflow content, making it invisible.

scroll – Adds both horizontal and vertical scrollbars.

auto – Adds scrollbars only when needed.

Example: Controlling Overflow

Using overflow: hidden;, any excess content will be clipped and not visible outside the container.

Image description

🎯 Conclusion

Today, we explored three essential CSS topics:

Styling lists to improve their appearance.

Using lists to create a navigation bar, making our menus clean and responsive.

Understanding the overflow property to manage content visibility.

By mastering these concepts, you’ll be able to build more visually appealing and functional websites. Keep experimenting, and happy coding! 🚀

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

đź‘‹ Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay