f



text-align left AND text-align-right in same container (on same line)

Is it possible to have a box (div) which sets a background-color and which
contains (on the same line) text which is left aligned and text which is
right aligned. (as in a table: two td's left one left aligned, right one
right aligned).

Thanxs!!


0
Sjef
9/21/2006 6:46:06 PM
comp.authoring.stylesheets 8158 articles. 0 followers. mdmoura (161) is leader. Post Follow

3 Replies
754 Views

Similar Articles

[PageSpeed] 10


At approximately 2006/09/21 15:46, Sjef Janssen typed these characters:

>Is it possible to have a box (div) which sets a background-color and which
>contains (on the same line) text which is left aligned and text which is
>right aligned. (as in a table: two td's left one left aligned, right one
>right aligned).
>
>Thanxs!!
>
>
>  
>
How about a div containing two divs. The inner divs could be aligned 
separately
sample below has a different color border around each box but share the 
same background color.

Gil

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <title>Alignment test</title>
    <style>
    #container{background-color:pink;border:1px solid black; width:220px}
    #left    {margin:0;padding:0;border:1px solid blue;width:100px; 
text-align:left; display:block; float:left;}
    #right    {margin:0;padding:0;border:1px solid red;width:100px; 
text-align:right; display:block; float:right;}
    </style>
</head>

<body>
<div id="container">
<div id="left">This text should be aligned to the left</div>
<div id="right">But this text should be aligned to the right</div>
</div>
</body>
</html>
0
gil
9/21/2006 9:44:10 PM
"Sjef Janssen" <manuals-scripts@planet.nl> wrote:

>Is it possible to have a box (div) which sets a background-color and which
>contains (on the same line) text which is left aligned and text which is
>right aligned. (as in a table: two td's left one left aligned, right one
>right aligned).

Why, what are you trying to do?

-- 
Spartanicus
0
Spartanicus
9/21/2006 10:15:03 PM
My first idea was to solve it with a table inside the box, But that's not 
CSS is it? The container idea with the two div's inside solves it as well, 
now with CSS! Thanks for thinking with me!!

Sjef

"Sjef Janssen" <manuals-scripts@planet.nl> schreef in bericht 
news:4512de2c$0$2028$ba620dc5@text.nova.planet.nl...
> Is it possible to have a box (div) which sets a background-color and which
> contains (on the same line) text which is left aligned and text which is
> right aligned. (as in a table: two td's left one left aligned, right one
> right aligned).
>
> Thanxs!!
>
> 


0
Sjef
9/22/2006 7:13:32 AM
Reply: