I'm trying to write a stylesheet that styles the following html
body > * {
width: 49%; /* should be 50% */
display: inline-block;
text-align: center;
overflow: hidden;
margin: 0;
}
body {
margin: 0 auto;
line-height: 0px;
width: 80%;
}
<html><body>
<span><h1>some text here</h1></span>
<img src="img.png"></body></html>
But on iOS Safari, the bottom margin from the h1 expands past the baseline and (in the full version, that has multiple rows), pushes down the rest of the content. If I use overflow: scroll
, this fixes it for Safari, but on other browsers messes up the view. How can I detect that this is Safari and fix it or use a different way to construct the block formatting context? I would prefer not to use Javascript, but I think that there's a chance I'll have to.