Here is the HTML:
<div id="menu">
<ul>
<li><a href="#">Home</a>
</li>
<li><a href="#">Blog</a>
</li>
<li><a href="#">About</a>
</li>
<li><a href="#">Contact</a>
</li>
</ul>
</div>
Here is the CSS:
li {
display:inline;
padding: 10px;
}
#menu {
margin: 21px 646px 21px 646px;
}
I cannot seem to increase the space between the menu items. What should I adjust to do so?
To create space between list bullets and text in HTML, use CSS padding property. Left padding padding-left is to be added to <ul> tag list item i.e. <li> tag. Through this, padding gets added, which will create space between list bullets and text in HTML.
The best way to add space between two HTML elements is to add either padding or a margin in CSS. padding will add space to the outside of an element and margins will add space between two elements.
The CSS margin property controls the space between different HTML elements on a webpage. Use margin to bring page elements closer together or to move them further apart.
try
a {
display: block;
padding: 10px 30px;
}
edit
Do you want something like this ? http://jsfiddle.net/Y8Ng7/
Just remove that ridiculous margin you have for the nav and increase the li padding
li {
display:inline;
padding: 10px 40px;
}
To center a div element, don't do margin: 21px 646px 21px 646px;
just do margin: 21px auto;
You just need to add display:inline-block;
in list menu.
Change your CSS
like below :
li {
display:inline-block;
padding: 10px;
}
#menu {
margin: 21px 646px 21px 646px;
}
Or See Here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With