Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Top margin inside a div do not work?

Tags:

html

css

I have a div that contains links (a href). All other margins are working with a href but Top margin is not working with a href. I want to place links in middle but because of not working of top margin it is not being possible. I heared by setting position or display it can work. Please suggest a cross broswer solutions for it.

div.MainContainer div.Links
{
    height: 57px;
    width: 100%;
    border-top: solid 0px #404040;
    border-left: solid 2px #404040;
    border-right: solid 2px #404040;
    border-bottom: solid 2px #404040;
    background-image: url("../Images/links_background.png");
}
div.MainContainer div.Links a
{
    font:12px verdana;
    color:White;
    margin:10px;
    border:dashed 1px white;
    margin:15px 20px 20px 20px ;
    width:100px;
}
like image 507
haansi Avatar asked Oct 25 '10 13:10

haansi


1 Answers

You need to float element to make margin working or use padding instead.

div.MainContainer div.Links a
{
    float: left;
    font:12px verdana;
    color:White;
    margin:10px;
    border:dashed 1px white;
    margin:15px 20px 20px 20px ;
    width:100px;
}
like image 154
Badr Hari Avatar answered Sep 21 '22 14:09

Badr Hari