![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
This has a header which 'spans' (in my terminology) both columns and I use this in this way: body div id="Header" My Website name /div |
|
What I want now is to have two bits of text in my header; one left-aligned (like the 'My Website Name' text above, and a second part right-aligned. |
|
weblog | http://www.pretletters.net/weblog/weblog.html | webontwerp | http://www.pretletters.net/html/webontwerp.html | zweefvliegen | http://www.pretletters.net/html/vliegen.html | |
#3
| |||
| |||
|
|
body div id="Header" My Website name /div That's no good. It looks like a heading of the first level. Use that. h1>My Website name</h1 I assume by 'no good' you mean stylistically rather than syntactically? |
|
What I want now is to have two bits of text in my header; one left-aligned (like the 'My Website Name' text above, and a second part right-aligned. h1>My Website name <span>right-aligned bit of text</span></h1 h1 { /* the looks you created for the div#header previously don't make it overly complicated though */ } h1 span { display:block; float:right; } |
#4
| ||||
| ||||
|
|
That's no good. It looks like a heading of the first level. Use that. h1>My Website name</h1 I assume by 'no good' you mean stylistically rather than syntactically? I do actually use h1 elsewhere, |
|
I tried this, in my form: #Header span {display: block; float: right;} div id="Header" My Site Name<span>My Right-aligned text</span /div |
|
And got what I was seeing before - the right-aligned text appears to the right, as desired, but around a line below the text at the left. It's this I'm trying to correct. |
|
weblog | http://www.pretletters.net/weblog/weblog.html | webontwerp | http://www.pretletters.net/html/webontwerp.html | zweefvliegen | http://www.pretletters.net/html/vliegen.html | |
#5
| |||
| |||
|
|
#Header { margin:50px 0px 10px 0px; padding:17px 0px 2px 20px; /* For IE5/Win's benefit height = [correct height] + [top padding] + [top and bottom border widths] */ height:35px; /* 14px + 17px + 2px = 33px */ border-style:solid; border-color:#999999; /* black; */ border-width:1px 0px; /* top and bottom borders: 1px; left and right borders: 0px */ voice-family:inherit; height:14px; /* the correct height */ } |
|
weblog | http://www.pretletters.net/weblog/weblog.html | webontwerp | http://www.pretletters.net/html/webontwerp.html | zweefvliegen | http://www.pretletters.net/html/vliegen.html | |
#6
| |||
| |||
|
|
I tried this, in my form: #Header span {display: block; float: right;} div id="Header" My Site Name<span>My Right-aligned text</span /div |
|
And got what I was seeing before - the right-aligned text appears to the right, as desired, but around a line below the text at the left. It's this I'm trying to correct. |
|
I think you might have a combined value for top margin and padding that excede the total height of the element the span |
#7
| |||||
| |||||
|
|
#Header span {display: block; float: right;} div id="Header" My Site Name<span>My Right-aligned text</span /div Please use a space before the span, so people with browsers without CSS don't get 'My Site NameMy Right-aligned text' Actually, I had a in there, just not on my cut-down example... |
|
URL:http://www.pretletters.net/_test/two_blocks_in_a_page_heading.html>, nothing weirds happens. I had a look at your page, and interestingly Firefox seems to behave differently to other browsers! |
|
With FF I'm seeing what I was seeing on my page - the 'right aligned text' is outside the red border, on the line below. So am I encountering a bug in Firefox? |
|
BTW, on the other two browsers, when I narrow the window the right text 'drops' a line, rather than overlapping, so I don't really get the effect you mention above. |
|
weblog | http://www.pretletters.net/weblog/weblog.html | webontwerp | http://www.pretletters.net/html/webontwerp.html | zweefvliegen | http://www.pretletters.net/html/vliegen.html | |
#8
| |||
| |||
|
|
I had a look at your page, and interestingly Firefox seems to behave differently to other browsers! |
|
BTW, on the other two browsers, when I narrow the window the right text 'drops' a line, rather than overlapping, so I don't really get the effect you mention above. |
#9
| |||
| |||
|
|
#Header span {display: block; float: right;} div id="Header" My Site Name<span>My Right-aligned text</span /div You did mention FF and I failed to take a look with that browser. It does 'dis'behave. Darn. :-( Never noticed this before. With FF I'm seeing what I was seeing on my page - the 'right aligned text' is outside the red border, on the line below. So am I encountering a bug in Firefox? Could be. I don't know actually. And I don't know my way around bugs and bug reports either. Maybe another poster. Somebody? |
#10
| |||
| |||
|
|
When you float something to the right, it does not magically go up one line. To have it on the same line as other text, place the float *before* the other text. |
![]() |
| Thread Tools | |
| Display Modes | |
| |