CSS- removing horizontal space in list menu using display inline property

Posted by Kayote on Stack Overflow See other posts from Stack Overflow or by Kayote
Published on 2011-01-17T17:49:27Z Indexed on 2011/01/17 17:53 UTC
Read the original article Hit count: 191

Filed under:
|
|

Hi All,

Im new to CSS and have a set target of learning & publishing my website in CSS by the end of the month.

My question:

Im trying to build a CSS horizontal menu with hover drop downs, however, when I use the 'display: inline' property with li (list) items, I get horizontal spaces between the li (list) items in the bar. How do I remove this space?

Here is the html:

<div id="tabas_menu">
                        <ul>
                                <li id="tabBut0" class="tabBut">Overview</li>
                                <li id="tabBut1" class="tabBut">Collar</li>
                                <li id="tabBut2" class="tabBut">Sleeves</li>
                                <li id="tabBut3" class="tabBut">Body</li>
                        </ul>
                </div>

And here is the CSS:

#tabas_menu {
        position: absolute;
        background: rgb(123,345,567);
        top: 110px;
        left: 200px;
}

ul#tabas_menu {
        padding: 0;
        margin: 0;
}

.tabBut {
        display: inline;
        white-space: 
        list-style: none;
        background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,142,190,1)),to(rgba(188,22,93,1)));
        background: -moz-linear-gradient(top, rgba(255,142,190,1), rgba(188,22,93,1));
        font-family: helvetica, calibri, sans-serif;
        font-size: 16px;
        font-weight: bold;
        line-height: 20px;
        text-shadow: 1px 1px 1px rgba(99,99,99,0.5);
        -moz-border-radius: 0.3em;
        -moz-box-shadow: 0px 0px 2px rgba(0,0,0,0.5);
        -webkit-border-radius: 0.3em;
        -webkit-box-shadow: 0px 0px 2px rgba(0,0,0,0.5);
        padding: 6px 18px;
        border: 1px solid rgba(0,0,0,0.4);
        margin: 0;
}

I can get the space removed using the 'float: left/right' property but its bugging me as to why I cannot achieve the same effect by just using the display property.

© Stack Overflow or respective owner

Related posts about css

Related posts about display