Mahaveer sharma Mahaveer sharma - 1 year ago 114
HTML Question

CSS margin not working right

Can someone please tell me , why i can't add margin-top/bottom or padding-top/bottom to this "a" tag.
I need to ceter "Konoha" in the Header box

<header class = "top-box">
<a href="#">Konoha</a>

the CSS is

background-color: white

width: 88.5%;
height: 1200px;
margin: 0 auto;
border: 2px solid black;
background-color: #161e2c;

margin:0 auto;
width: 99.5%;
height: 153px;
background-color: #314e59;
border:1px solid rgb(211, 41, 97);
box-shadow: 0px 10px 7.4px 2.6px rgba(0, 0, 0, 0.74);

color: white;
text-decoration: none;
font-size: 100px

Answer Source

anchor is a inline element if you want to use padding-top/bottom, you should using add display:block for anchor tag

color: white;
text-decoration: none;
font-size: 100px;


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download