Found 1594 Articles for CSS

How to create a dropup menu with CSS?

AmitDiwan
Updated on 06-Apr-2020 11:11:29

806 Views

Following is the code to create a dropup menu with CSS −Example Live Demo .menu-btn {    background-color: #7e32d4;    color: white;    padding: 16px;    font-size: 20px;    font-weight: bolder;    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;    border: none; } .dropdown-menu {    position: relative;    display: inline-block;    padding-top: 130px; } .menu-content {    display: none;    position: absolute;    bottom: 50px;    background-color: #017575;    min-width: 160px;    z-index: 1; } .links {    color: rgb(255, 255, 255);    padding: 12px 16px;    text-decoration: none;    display: block;    font-size: 18px;    font-weight: bold;    border-bottom: 1px solid black; } .links:hover {    background-color: rgb(8, 107, 46); } .dropdown-menu:hover .menu-content {    display: block; } .dropdown-menu:hover .menu-btn {    background-color: #3e8e41; } Hover over the below button to open a dropup menu Open

How to create a subnavigation menu with CSS?

AmitDiwan
Updated on 14-Dec-2023 12:20:35

1K+ Views

A subnavigation menu is a menu that appear just below the main menu. The menu is created using the element on a web page. Consider it as a secondary menu or a submenu. The submenus appear on mouse hovering any of the menus from the main menu. This is set using the :hover selector. Create a menu A menu on a web page is created using the element. For the submenus, a div container is created and the menu links are set using the element − Home Contact ... Read More

How to create a responsive navigation bar with dropdown in CSS?

AmitDiwan
Updated on 27-Oct-2023 11:28:14

2K+ Views

To create a responsive navigation bar, the media queries are used. Media Queries is used when you need to set a style to different devices such as tablet, mobile, desktop, etc. The navigation bar with dropdown looks like the following. The dropdown menu is having Contact Us, Visit Us, and About Us sub-menus − Style the Navigation Menu and Links The background color of the navigation menu are set here, with the links. The menu links are set with the display property inline-block. It displays an element as an inline-level block container − nav{ background-color: ... Read More

How to create a dropdown navigation bar with CSS?

AmitDiwan
Updated on 03-Jul-2024 17:34:19

15K+ Views

Dropdown navigation is a nav bar that contain dropdown option. You will see a lot of websites where 3rd or 4th item of the navigation has the dropdown feature. When there are multiple options to render on nav bar item on the same category thats where you will need to develop a dropdown navigation bar. Suppose you are providing multiple types of services then you can not render all of them openly on the nav bar, you will put all of them in a dropdown. It is similar to hoverable dropdown menu. Steps to Create a Dorpdown Navbar ... Read More

How to create a hoverable dropdown menu with CSS?

AmitDiwan
Updated on 27-Jun-2024 18:09:42

5K+ Views

Hoverable dropdown is dropdown that opens when we hover on that dropdown. This kind of dropdown are mostly used on header menu. If the user hover over on any element of the header menu then it will automatically open and render the content of that dropdown. Steps to Create Hoverable Dropdown Before proceeding to create a hoverable dropdown we will create a dropdown structure first using HTML. Step 1 - Add HTML: Here we will create dropdown structure for that we can use , or any element. here in this article we will use the button element. ... Read More

How to add a navigation menu on an image with CSS?

AmitDiwan
Updated on 15-Nov-2023 14:01:10

1K+ Views

Adding a navigation menu on a web page is not a difficult task. With that, we can easily add a navigation menu on an image. Let us first set the margin and padding for the HTML document’s body. Set the Style for the Document’s Body The margin and padding are set for the element using the margin and padding property respectively − body { margin:0px; margin-top:10px; padding: 0px; } The Position of the Menu The menu is placed after some margin on the top of the web page. This vertical top position is set using the margin-top property − margin-top:10px; Set ... Read More

How to create a "fixed" menu with CSS?

AmitDiwan
Updated on 17-Nov-2023 10:38:18

722 Views

To create a fixed menu on a web page, use the position property and set the value fixed. Set the width to 100% using the width property. Set the Navigation Menu Use the element to create the navigation menu on a web page. The links are set using the and the href attribute − Home Login Register Contact Us More Info Style the Navigation Menu We have positioned the menu as fixed using the position property with the value ... Read More

How to create a navigation bar with equal-width navigation links with CSS?

AmitDiwan
Updated on 03-Apr-2020 10:47:08

1K+ Views

Following is the code to create a navigation bar with equal-width navigation links.−Example Live Demo Document body{    margin:0px;    margin-top:60px;    padding: 0px; } *,*::before,*::after{    box-sizing: border-box; } nav{    position: fixed;    top: 0;    width: 100%;    background-color: rgb(39, 39, 39);    overflow: auto;    height: auto; } .links {    width: 20vw;    padding: 17px;    display: inline-block;    text-align: center;    color: rgb(178, 137, 253);    text-decoration: none;    font-size: 17px; } .links:hover {    background-color: rgb(100, 100, 100); } .selected{    background-color: rgb(0, 18, 43); } Home Login Register Contact Us More Info Equal width navigation menu OutputThe above code will produce the following output −

How to create a navigation bar with a centred link/logo with CSS?

AmitDiwan
Updated on 03-Apr-2020 10:43:53

409 Views

Following is the code to produce a navigation bar with a centered link/logo −Example Live Demo Document body{    margin:0px;    margin-top:60px;    padding: 0px; } nav{    position: fixed;    top:0;    width: 100%;    background-color: rgb(251, 255, 196);    overflow: auto;    height: auto; } .left-links{    display: inline-block;    position: absolute;    left: 0; } .right-links{    display: inline-block;    position: absolute;    right: 0; } .center-links{    display: inline-block;    margin-left: 50%; } .links {    display: inline-block;    text-align: center;    padding: 14px;    color: rgb(0, 0, 0);    text-decoration: none;    font-size: 17px;    font-weight: bolder; } .links:hover {    border-bottom: 2px solid purple; } .selected{    border-bottom: 2px solid purple; } Login Register Home Contact Us More Info Hover on the above links OutputThe above code will produce the following output−

How to create a navigation bar with left-aligned and right-aligned links with CSS?

AmitDiwan
Updated on 05-Sep-2024 17:13:43

11K+ Views

To create a navigation bar with left-aligned and right-aligned links with CSS, user should have a basic understanding of CSS flexbox. First, we will create the structure of navigation bar having five links using HTML, then we will use CSS to design the navigation bar and align the links on the left and right sides of the navigation bar, and apply flexbox properties to ensure proper positioning of links. We are having a navigation menu containing five links, our task is to create a navigation bar with left-aligned and right-aligned links with CSS. In this article, we will be implementing ... Read More

Advertisements