Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable Width in DIV tag?

Status
Not open for further replies.

Ovatvvon

Programmer
Feb 1, 2001
1,514
US
I feel silly that I don't know the answer to this...maybe I'm just having a brain-laps or something today, I dunno. So please forgive me.

I'm creating a DIV tag that can display a variety of different text lengths. It can in one instance hold a paragraph of information, and the next hold only a few words. I want to have it so when there's only a few words, they'll be centered on the page, however, if there's a paragraph of text, it'll all be aligned to the left within the DIV tag, yet the DIV tag will still be centered in the page (having a width still set at 550px), so it looks like the paragraph is 550px in width, but aligned to the left like normal writing. But if the writing is only a few words, it'll be aligned to the left in the 550px DIV that is centered on the page...making the text look like it is offcenter because the DIV is always staying at 550px.

Is it possible to have the DIV automatically adjust in width based on the amount of text held inside it? (So far, without setting a width, it automatically goes to 100% of the width of the page.)

-Ovatvvon :-Q
 
Oh, if you want to see an example of what I'm talking about, here are two pages to look at:


Paragraph Format: (Look for the only paragraph in the middle which starts out as..."A press kit or promotional material")
[URL unfurl="true"]http://members.pintesoft.com/georgia/section2.asp?page=7[/url]


Sentence Format: (Look for the sentence in the middle that reads..."Detailed Statements Written Up For Smaller Text Entry.")

[URL unfurl="true"]http://members.pintesoft.com/georgia/section2.asp?page=6[/url]


-Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top