Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Creating navigation/menu bar via css problem

Featured Replies

Hello I am trying to create a horizontal navation bar via htm/css. I can do it fine without any problems however the problem arises when trying to change the gap between the text. For example if I have links such as Home Buy About etc I want to be able to change (widen or narrown) the gap between the text. I've been trying to work it out for a few hours and I'm not getting very far. I only want to do it using html or css. Any help would be much appreciated.

 

Here is the basic code I am working with for testing purposes:

 

 

<!DOCTYPE html>
<html>
<head>
<style>
ul
{
list-style-type:none;
margin:0;
padding:0;

}
li
{
display:inline;
}
</style>
</head>

<body>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>

</body>
</html>
 

Edited by teodora
wrapped your code. Please use <> icon :)

You can add paddings to your list elements, like this:

 

li
{
display:inline;
padding-left:1em; /*adjust to suit*/
padding-right:1em; /*adjust to suit*/
}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.