Css Top Margin Trick


Sometimes you see that on the browser there show a margin from top as by default and it is about 20px in height. But when you view the same page in other browser it looks fine, there is no margin from the top. Now, what to do to fix it or to make is compatible with all the browsers so that it look same in all the browsers. Many people use a trick by applying top margin in negative (margin-top: -20px;). Sometimes it works but it is not a good solution. Also some people use CSS-Hacks to fix this, but what about those who don’t know how to fix this. So there is a better solution to do this. Just in the very first line of you CSS write the code below.
*{margin:0px; padding:0px;}
And done……
Just a single line of code fix this problem.
Here * is for all the elements in the html page. It sets default margin and padding to 0px;

Comments

Popular posts from this blog

Get Query String Values With Javascript

Change Css Class of li in ul onclick

Change Text Color with Javascript