On 5/11/2012 8:08 AM, dorayme wrote:
>> That the embedded div should include display:inline;
> Not really. The OP said
> "I'm currently doing it like this: ...."
> I said*this* did not work in my browsers. I still see no such
> display: inline in his code and while addition of an display: inline;
> *improves* the situation a bit, it still does not solve it (see what
> happens when text size is changed; at least I am seeing what happens
> here and the line goes clean under all at small text sizes).
should include display:inline;
or
should have included display:inline;
It seems that the different browsers, including the different Webkit
flavours, have a different increment and extreme range of size changes
available. FF and Safari, for example, do not reach the ridiculously
extreme and uselessly very small size that Opera and Chrome do. In the
extreme smallest size available in FF and Safari, all the methods render
well, whereas in the much smaller size available in Opera and Chrome
most of the methods cause the text to be above the border. The failure
in the ridiculously extreme and uselessly very small size available only
in Chrome and Opera should not bother anyone and should be ignored IMHO.
Aside from that, all three methods I presented in the other post, along
with the OPs original method, with display:inline; included, work
perfectly well for me in all these browsers.
> In an earlier reply I gave what seems now a stupid solution, I cannot
> believe how I did this! I saw with my own eyes it working well and now
> I look again it is nowhere near! I sure missed something there!
I don't understand. Your solution works well for me aside from the
ridiculously small size setting mentioned above.
> I note one of your solutions, in a next post, is good. Well done.
I wonder which you you are referring to?
BTW, the only solution which works for me in all methods and in the
ridiculously small size setting mentioned above is the OPs solution with
the display:inline; included. Four methods here for ease in testing:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Simulate Insert Leader</title>
<style>
em {font-family:monospace;font-style:normal;background:yellow;}
</style>
</head>
<body>
<div style="border-bottom: 1px solid #BFBFBF; width: 90%">
<div style="display:inline; position: relative; top: 5px;
background-color:#FFFFFF; padding: 0 7px; margin-left: 15px">
Variable Text
</div>
</div>
<p style="margin-bottom:3em;">OPs original - using a div and forgetting
<em>display:inline;</em> but used here.</p>
<div style="position: relative; padding-top: .5em; border-bottom: 1px
solid #BFBFBF; width: 90%">
<div style="position: absolute; top: -.5em;background-color:#FFFFFF;
margin-left: 15px">
Variable Text
</div>
</div>
<p style="margin-bottom:3em;">This one was "dorayme's" suggestion.<br>
Using a div and <em>position:absolute</em>.</p>
<div style="border-bottom:1px solid #BFBFBF;width:90%">
<span style="position:absolute;left:23px;padding:0
7px;margin-top:-1em;background:white;">
Variable Text</span>
</div>
<p style="margin-bottom:3em;">Using a span and
<em>position:absolute;</em><br>
We could give the div <em>pos:relative;</em> and then the span could
take <em>margin-left:15px;</em> instead of
<em>left:23px; (body margin=8px)</em>.<br>
<span style="text-decoration:underline;">This one is my
preference.</span></p>
<div style="border-bottom:1px solid #BFBFBF;width:90%">
<span style="float:left;position:relative;left:15px;padding:0
7px;margin-top:-1em;background:white;">
Variable Text</span>
</div>
<p style="margin-bottom:3em;">Using a span, <em>float:left;
position:relative;</em><br>
Instead of <em>position:relative;left:15px;</em> we could simply have
<em>margin-left:15px;</em>.</p>
</body>
</html>