All,
I was hoping that someone might be able to help me with a few questions on Aligning Block Elements properly...
Basically I have a row that has a fixed width of 900px. Within the row their is a <Divthat I want to align to the Right hand side of the <Div id= Container >. That div <Div id=itemsneeds to be able to expand and contract based on the amount of text that is held within the <p id="p1">.
This example is as close as I can get to showing what I'm trying to achieve. However the two issues are:
1) Align is not a valid attribute of the Div element...
2) The element <div id="Items"is a fixed width. I have no idea how many items will be contained within <p id="p1"and I don't want the text to wrap. Additionally I always want to have <p id="p2"align with the left hand margin of <p id="p1">.
<body>
<style type="text/css">
#Container{
clear:both;
width:900px;
}
#Items{
width:160px;
margin:0;
padding:0;
font: bold 11px/14px Arial;
text-align:left;
color: #928D92;background-color:yellow;
}
</style>
<div id="Container" align="right">
<div id="Items" style="">
<p id="p1">
item1 item2 item3 item4
</p>
<p id="p2">
item1 item2 item3
</p>
</div>
</div>
</body>
I've had some success with the following, as it eliminates the two problems stated above(The Align attribute and fixed width)... but I can't figure out how to get the second <p id="p2"to align with the left most margin of <p id="p1">???
<body>
<style type="text/css">
#Container{
clear:both;
width:900px;
text-align: right;
}
#Items{
display:inline;
margin:0 8px 0 0;
}
#Container p{
display:inline;
font: bold 11px/14px Arial;
color: #928D92;
background-color:yellow;
}
</style>
<div id="Container">
<div id="Items">
<p id="p1">
item1 item2 item3 item4 item5
</p>
<!-- Need to add a second <pthat will align to the left margin of item1 -->
</div>
</div>
</body>
If anyone has any clue as to how this can be accomplished I would be great full!!! Thanks in advance. - CES