Why is h3 always bold?

Associate
Joined
30 Nov 2003
Posts
1,613
So I had some headings I wanted to format to the right with size 0.8em. I thought I might as well wrap the h3 tags round it and specify this in CSS.

I did this and sure enough it aligns to the right, but it also seems to have some formatting of its own which is driving me mad. For some reason is is bold and it also acts as if there is a line break before it. wtf?

I tried setting the margin and padding to 0 yet it still missed a line. Also I tried setting the text-weight to none yet its still bold. I'm tearing my hair out here. :confused:
 
so you have a heading, but you dont want it on a seperate line? you want an in-line heading? if so why not just use <b> or <strong>?

but to answer your question the css your looking for is

h3 {font-weight:normal;display:inline}

but using a h3 in this way makes little sense
 
Well there kind of headings its my cv so I have the year on the left of the company I work for and on the right of the same line the company name.

I thought I may as well just use the h3 tag since it was unused rather than make another class.

But anyway I ended up creating another class called textRight which for some reason doesn't make the text go right. :confused:

Code:
<span class="textRight">Name of company</span>

Code:
.textRight{
text-align:right;
}
 
span is an inline element so it has no left and right alignment

when css defines "text-align:right" it means the text within the element, not the actual element itself, so to align the element, you will have to do something a little fancier

you should try something like this..

Code:
<h2>This text is aligned to the left <span>this to the right, and on the same line</span></h2>
and the css

Code:
h2 {position:relative}
h2 span {position:absolute;right:0}
 
Back
Top Bottom