Jump to content

Auto width sizing divs.. Sorry!


shelluk

Recommended Posts

Has any one managed to come up with some way of doing the following? Divs below each other with the width sized to the test with in.

 

__________
|          |
|   blah   |
|__________|

___________________________________
|                                   |
|   blah blah blah blah blah blah   |
|___________________________________|

____________________
|                   |
|   blah blah blah  |
|___________________|

 

I'm getting it all on top of each other though using the following code though (IE6 and FF3).

 

<html>
<head>
	<title>Test</title>

	<style type="text/css">
                     div {
                        position: absolute;
                        background-color: #EEEEEE;
                        width: auto;
                        padding: 20px;
                        border: solid 1px black;
                      }
  		</style>

</head>

<body>

	<div>			
                     this is a line of text this is a line of text this is a line of text this is a line of text
	</div>

	<div>
                    this is line 2
	</div>

	<div>
                    line 3		
	</div> 

</body>

</html>

 

It does seem may be one of those never ending no "one" answer questions. A lot of the forum posts I found in google though are all rather old as well.

 

Any ideas?

 

Thanks,

Shell :)

 

Link to comment
https://forums.phpfreaks.com/topic/111825-auto-width-sizing-divs-sorry/
Share on other sites

BTW. Realised it was clear by what I mean when I say "they appear on top". Like this:

 

__________ _____ _____________________________
|          |     |                             |
|  line 3  |e 2  |text this is a line of text  |
|__________|_____|_____________________________|

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.