Reputation: 237
Basically, I want to have an h1 and a p element on the same line, but the alignment is off a lot (meaning the H1 is higher than the P and looks crappy) and I've never had to do anything like this with css before!
I've thrown together a jsfiddle to accompany this, here is the code:
<h1 style="float:left;display:inline;">"Hi!</h1><p style="float:left;display:inline;">I'm James, and I <strong>LOVE</strong> building clean, fast and (most importantly) effective websites. Oh, and I also know a thing or two about computers.</p><h1 style="float:left;display:inline">"</h1>
Thanks!
Upvotes: 8
Views: 26115
Reputation: 201568
The technical problem with the code in the question is that float: left
prevents display: inline
from taking effect, setting display
to block
instead, so remove all the float: left
declarations.
A different issue is that you have the closing quotation mark as the content of an h1
element after the p
element. This is very illogical. The technical implication is that this character will appear in the font size of h1
, causing uneven line spacing unless you set h1
font size to the same as p
font size. You need to decide what you want: why would you want to a have a large-size closing quote after normal-size text, and if you do, how should it be rendered?
Upvotes: 2
Reputation: 577
Some advice before answer:
Try this and let me know if it works
HTML:
<h1 >"Hi!</h1><p>I'm James, and I <strong>LOVE</strong> building clean, fast and (most importantly) effective websites. Oh, and I also know a thing or two about computers.</p><h1>"</h1>
CSS:
p
{
display:inline;
}
h1{
display:inline
}
Upvotes: 3