Yes. Or at least a block level element like DIV. Generally, it is bad form to have inline elements be siblings with block elements A + P , for example…
It IS. P is block item, the As and SPANs are not. If you want them to be you will need to route rules declaring the to be display:block; Ex: #welcome span { display:block;}
On an unrelated note… why do you have non-breaking spaces between words???
“The echo of a distant time / Comes willowing across the sand / And everything is green and submarine …”
Seriously tho, they are there ( BT, I would suggest not using BR and just wrapping your intended output in a block level element which you can style …
I cant see your actual file , but remember that if you are using PHP, your file name should be INDEX.PHP not INDEX.HTML
So should I use <div> or <p>?? (I bet Paul O and DeathShadow have opinions…)
It IS. P is block item, the As and SPANs are not. If you want them to be you will need to route rules declaring the to be display:block; Ex: #welcome span { display:block;}
Well, I want the Logo and the Welcome to be on the same line, so how do I do that?
I also want my PHP echo statements to appear below the Logo/Welcome for now…
On an unrelated note… why do you have non-breaking spaces between words???
Because I wanted to wider space between “Hello. Log In to access premium content.” and “Not a Member?” and “Start Here”…
“The echo of a distant time / Comes willowing across the sand / And everything is green and submarine …”
Huh?
Seriously tho, they are there ( BT, I would suggest not using BR and just wrapping your intended output in a block level element which you can style …
The crux of this thread is styling things properly so the Logo and Welcome are on the same line and then everything else is below them. (Right now my first test echo is showing up to the right of the “Welcome” style…
I cant see your actual file , but remember that if you are using PHP, your file name should be INDEX.PHP not INDEX.HTML
Sorry - it’s just I’m not expecting to see PHP statements in the page.
I’m doing my best to help, and I believe my answer is correct. Use Firebug to take the float off that paragraph and you’ll see it extends across the page.
For #1 I would suggest DIV as it’s semantically neutral and a logo is not a paragraph. #2 did you mean THE ELEMENTS #welcome and #logo to appear side by side?
#welcome span {display:block;} should produce results like these:
[PRE] Hello. Log In to access premium content. Not a Member? Start Here
[/PRE]
And your logo position should be unaffected.
The lesson is that DISPLAY:BLOCK; on an element is like putting a BR above and bellow it.
I would rewrite that section like this:
<p id="welcome"> Hello. <span> <a href="">Log In</a> to access premium content.</span><span>Not a Member? <a href="">Start Here</a><span></p>
Move the type rules for #hello in to #welcome{}, then reset them in #welcome span{} and add display block;
and yes adding clear:both; to the first echoed <P> should make everything drop where it’s supposed to.
#2 did you mean THE ELEMENTS #welcome and #logo to appear side by side?
Can you see my screenshot?
What I want is the Logo is in the upper left-hand corner and immediately to the right my “Hello. Log In to access premium content. Not a Member? Start Here”
(Exactly like my screenshot shows…)
The problem is that the test echo statements I put in aren’t starting on the next line below the Logo and Welcome. (Even though the PHP echo statements are just for testing purposes, I want to understand why they are being displayed weird, because that shows me my CSS isn’t completely right…)
The lesson is that DISPLAY:BLOCK; on an element is like putting a BR above and bellow it.
But if I have the Logo floated to the far left, and the the Welcome is floated to the left (and to the right of the Logo) and I put a
display: block
on either one, then won’t my Logo and Welcome be on separate lines as well?
and yes adding clear:both; to the first echoed <P> should make everything drop where it’s supposed to.
Ah. I dont thing you are understanding that the clear attribute always needs to be applied to the element following the float. so you woun’t give #welcome clear: both , you would give it to the element immediately following it.
leaving IE compatibility out of this just to simplify my answer :
#welcome +* {clear:both;}
but the better solution, which I was hinting at earlier, was to give the FIRST P in your PHP output a class, which has the clear:both attribute.