Reputation: 10982
I have a web page with a text box. The background is black and the text is white. It displays correctly in Chrome and Safari, but for some reason the display is way off in Firefox. For arguments sake that could be reversed, that it is correct in Firefox but not Chrome or Safari - I am just going with the majority for now.
Here is the HTML:
<div class="col-sm-6 black">
<p style="text-align:center">Each unit is full of character and convenience with original hardwood floors, 10’ ceilings, washer/dryer and walkability to local restaurants and shops. </p>
<p style="text-align:center">Rents range from $825 – $950/month.</p>
<p style="text-align:center">Call us to reserve your unit: </p>
<p class="estilo big" style="text-align:center">919-292-2200</p>
<p class="estilo" style="text-align:center">or through Facebook messenger.<br />
facebook.com/thelutterloh</p>
</div>
Here is the CSS:
.black { background-color: #000; padding: 15px 15px 65px 15px; }
This is how it looks in Chrome and Safari:
This is how the same code renders in Firefox:
I have looked extensively for a solution and have have seen nothing that would resolve this. Also, Mozilla does not have a -moz specific styling that can be applied.
Any help would be appreciated.
Upvotes: 1
Views: 42
Reputation: 71
You can also use @font-face which will help keep your font consistent between browsers instead of the browser using its default. https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face
Upvotes: 1
Reputation: 1155
The inconsistency in the font-size seems to be causing the height of the .black
div to increase in case of firefox (since the font-size appears to be higher). The padding added on top of this increases the total height of the div.
I would recommend using normalize.css or CSS resets before doing any of your styling to avoid such scenarios.
Another workaround is for you to set box-sizing: border-box
and set a max-height
on the .black
div., along with overflow:hidden
.
Upvotes: 2