HighDots Forums  

Can a div's width expand to fit content's width?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Can a div's width expand to fit content's width? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Dave Rado
 
Posts: n/a

Default Re: Can a div's width expand to fit content's width? - 04-10-2008 , 02:03 AM






Hi Berg

On 10 Apr, 05:19, Bergamot <berga... (AT) visi (DOT) com> wrote:

Quote:
I'd call IE out of touch, for not supporting the properties that give the
results you are really after - display:table etc.
True ...


Quote:
Are you aware that your doctype triggers quirks mode in IE6? Drop the
xml prolog.

That's done on purpose because of IE6's bugs when in strict mode. IE7
is running in strict mode though. And this has no effect on this
particular uissue.

Dave


Reply With Quote
  #12  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: Can a div's width expand to fit content's width? - 04-10-2008 , 10:16 AM






Dave Rado wrote:

Quote:
On 10 Apr, 05:19, Bergamot <berga... (AT) visi (DOT) com> wrote:


Are you aware that your doctype triggers quirks mode in IE6? Drop the
xml prolog.


That's done on purpose because of IE6's bugs when in strict mode. IE7
is running in strict mode though. And this has no effect on this
particular uissue.
Any reason why you are using XHTML? Bet not...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #13  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: Can a div's width expand to fit content's width? - 04-10-2008 , 11:26 AM



Dave Rado wrote:
Quote:
Hi

I've created a banner with a drop-shadow using a div - there's a mock-
up at http://tinyurl.com/6n7czu . The only problem is that the way
I've done it, I have to specify the width of the div - if I don't, it
renders with a width of 100%. Is there any way of making the width fit
the text it encloses (plus padding), and so that it expand
automatically if you add more text?
Use float is the only way I know of and include IE, else you must
specify a width... simple examples

http://www.littleworksstudio.com/tem....20080410.html

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #14  
Old   
Dave Rado
 
Posts: n/a

Default Re: Can a div's width expand to fit content's width? - 04-10-2008 , 11:34 AM



On 10 Apr, 16:16, "Jonathan N. Little" <lws4... (AT) central (DOT) net> wrote:

Quote:
Any reason why you are using XHTML? Bet not...
See for example:
http://www.w3schools.com/xhtml/xhtml_why.asp

Dave


Reply With Quote
  #15  
Old   
Dave Rado
 
Posts: n/a

Default Re: Can a div's width expand to fit content's width? - 04-10-2008 , 11:35 AM



On 10 Apr, 17:26, "Jonathan N. Little" <lws4... (AT) central (DOT) net> wrote:
Quote:
Dave Rado wrote:
Hi

I've created a banner with a drop-shadow using a div - there's a mock-
up athttp://tinyurl.com/6n7czu. The only problem is that the way
I've done it, I have to specify the width of the div - if I don't, it
renders with a width of 100%. Is there any way of making the width fit
the text it encloses (plus padding), and so that it expand
automatically if you add more text?

Use float is the only way I know of and include IE, else you must
specify a width... simple examples

http://www.littleworksstudio.com/tem....20080410.html

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com
Floats don't meet my requirement for reasons discussed earlier in the
thread (the boxes have to be shrink-to-fit *and* centred). I've got it
working using tables though.

Dave


Reply With Quote
  #16  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: Can a div's width expand to fit content's width? - 04-10-2008 , 12:06 PM



Dave Rado wrote:
Quote:
On 10 Apr, 16:16, "Jonathan N. Little" <lws4... (AT) central (DOT) net> wrote:

Any reason why you are using XHTML? Bet not...

See for example:
http://www.w3schools.com/xhtml/xhtml_why.asp


Do not be deceived, www.w3schools.com has no association with w3.org.
Much on www.w3schools.com is just plain incorrect.

Except for a very narrow, often never used features, XHTML is no better
than HTML for creating websites. In fact unless you need the advanced
namespace and other features (which you don't) XHTML is an impediment to
your website design, much-much-much discussed here. If you do not know
what I am talking about then you *absolutely* do not need and should not
use XHTML.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #17  
Old   
Dave Rado
 
Posts: n/a

Default Re: Can a div's width expand to fit content's width? - 04-10-2008 , 01:00 PM



Hi Jonathan

On 10 Apr, 18:06, "Jonathan N. Little" <lws4... (AT) central (DOT) net> wrote:

Quote:
Do not be deceived,www.w3schools.comhas no association with w3.org.
Much onwww.w3schools.comis just plain incorrect.
I've seen loads of websites, though - I only gave that link as one
example of many - that say that if you want to be forced to write well
structured html, and if you're keen on standards (both of which are
true in my case), then using an xhtml doctype will help to you to do
that. (And my pages do all validate).


Quote:
Except for a very narrow, often never used features, XHTML is no better
than HTML for creating websites. In fact unless you need the advanced
namespace and other features (which you don't) XHTML is an impediment to
your website design, much-much-much discussed here. If you do not know
what I am talking about then you *absolutely* do not need and should not
use XHTML.
Why does Dreamweaver give you an xhtml transitional doctype by default
then? And given that I've already marked up several hundred webpages
in valid xhtml, with closing /> tags for images etc., is it really
worth the many hours of work it would take to change it back now?

Dave


Reply With Quote
  #18  
Old   
Dave Rado
 
Posts: n/a

Default Re: Can a div's width expand to fit content's width? - 04-10-2008 , 01:08 PM



On 10 Apr, 18:06, "Jonathan N. Little" <lws4... (AT) central (DOT) net> wrote:

Quote:
Except for a very narrow, often never used features, XHTML is no better
than HTML for creating websites. In fact unless you need the advanced
namespace and other features (which you don't) XHTML is an impediment to
your website design, much-much-much discussed here. If you do not know
what I am talking about then you *absolutely* do not need and should not
use XHTML.
Also in addition to my other reply, I've seen sites that rave about
the benefits of XMLHttpRequest etc., which admittedly I don't
currently use, but the point is, don't things like that mean that
using an xhtml doctype keeps more options open for you in the future?

Dave


Reply With Quote
  #19  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: Can a div's width expand to fit content's width? - 04-10-2008 , 01:11 PM



Dave Rado wrote:

Quote:
Why does Dreamweaver give you an xhtml transitional doctype by default
then?
Hmmm good one, it's self-answering ;-)

I don't use WYSIMWYG (What You See Is Maybe What You Get) editors, but I
believe you can set DW to code HTML 4.01 Strict


Quote:
And given that I've already marked up several hundred webpages
in valid xhtml, with closing /> tags for images etc., is it really
worth the many hours of work it would take to change it back now?
Well since they are most likely being incorrectly served as text/html,
yes. Also since most likely your pages are semi-xhtml a little parsing
with sed could fix them in a flash. I am sure someone here knows of an
xhtml stripping utility...

At the very least don't perpetuate your mistake by continuing to create
your new pages as xhtml...


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #20  
Old   
Bergamot
 
Posts: n/a

Default Re: Can a div's width expand to fit content's width? - 04-10-2008 , 03:13 PM



Dave Rado wrote:
Quote:
Why does Dreamweaver give you an xhtml transitional doctype by default
Because it's trendy, nothing more.

--
Berg


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.