Different text formats on same line

They have: 7 posts

Joined: Mar 2004

Can anyone tell me how to place text of different formats on the same line without making a separate DIV for each element? I am using CSS2; specifically, I am trying to put several hyperlinks and some additional text on the same line but am having problems. Thanks.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Do you have an example I could look at?

Try using clear: none, but I'm not sure of the exact nature of the problem.

They have: 7 posts

Joined: Mar 2004

An example would be, say you had some information to present to the user in three different forms: text, audio and video. Say you want to show a hyperlink for each media form followed by a title all on the same line. The HTML might look something like:

TEXT
AUDIO
VIDEO

Information

which I have tried; the hyperlinks all show up fine all on the same line; however, the last test item is on the next line. Any ideas? Thanks.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Ah, try setting the clear: none property as well as display: inline on the h5. I can't recall straight away if you need to use floats or not... but try the above first. Smiling

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Okay, why on earth are you doing it that way?

is a Heading. If you want your headings inline, that's fine, but don't use a heading element to make things small.

Hyperlinks are inline elements, so they need to be inside a block level element.

Assuming you're using

correctly, you should have this:

<h5>
<span class="options">
<a href="info.pdf">TEXT</a>
<a href="info.mp3">AUDIO</a>
<a href="info.avi">VIDEO</a>
</span>
Information
</h5>
'

Even that's not quite semantic, however it's closer and will do what you want.

They have: 7 posts

Joined: Mar 2004

Thanks for all the suggestions; I did get everything laid out the way I wanted.

He has: 1,758 posts

Joined: Jul 2002

I thought putting hyperlinks inside tags was against the w3 guidelines? I swear I read that somewhere...

They have: 7 posts

Joined: Mar 2004

Using in my example was a bad choice on my part; I'm actually using . Thanks.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.