9
When I define the padding
of some div
gives a difference of 1px
, I’m building a menu, defines the padding
in #menu ul li a
and the difference from one browser to the other is more 4 px
, there’s some hack for that?
<body>
<section>
<header>
<nav id="menu">
<ul>
<li><a href="home.php">Home</a></li>
<li><a href="produtos.php">Produtos</a></li>
<li><a href="contato.php">Contato</a></li>
<li><a href="quemsomos.php">Sobre nos</a></li>
</ul>
</nav>
</header>
<section>
</body>
</html>
body { background-color:#87CEEB; width:100%; height:10%; } header { width:1100px; height:200px; background-color:white; margin-left:120px; } nav#menu ul { padding-top:209px; padding-left:2px; } nav#menu li{ margin: -2px; /*TIRA O ESPAÇAMENTO DO MENU/ JUNTA OS*/ } nav#menu ul li { display: inline; /*DEIXA O MENU NA HORIZONTAL*/ } nav#menu ul li a { background-color:#FFF68F; text-decoration: none; /*TIRA O ANDERLINE DO MENU*/ padding-right:110px; /* DEFINE O TAMANHO DO MENU*/ padding-left:110px; /* DEFINE O TAMANHO DO MENU*/ padding-bottom:10px;/* DEFINE O TAMANHO DO MENU*/ padding-top:10px;/* DEFINE O TAMANHO DO MENU*/ margin-top:6px; }
I don’t like to use hacks for anything, maybe there’s something in your code that can be improved or reorganized. You could use the [~tag:css] and the [tag:html] so we can see
– Erlon Charles
The problem is probably not in the padding, but in something else, such as invisible characters or line height difference and/or fonts (even if only in a blank space). Please edit the question and post the code you are using.
– Bacco
If your html is exactly like this, I think you have to close the Nav:
</nav>
– Jorge B.
I closed the Nav, n is that the problem, I finally managed to post css, it is the first time q am using this forum.
– evandro
The point is that the font is rendered differently in each browser. Thus each font has a different width. The ideal would be to add a fixed width and height if you want this level of accuracy, but this is usually accepted by people who understand how web development works.
– teefars