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!

Frustrated! I don't get how to line things up CSS 1

Status
Not open for further replies.

DaRNCaT

Technical User
Dec 18, 2002
566
NZ
I need help, I've been trying to this for ages, and it just looks terrible, I have looked for examples, but it seems like there are none the way I want it.
Basically I want:

picture text
text picture
picture text

like that down the page, so each lot of text has a picture with it, aligned to the left for the first lot of text and then the right for the next lot.
I can't get this to line up at all, so I'm not even going to try posting my code.
Can someone please explain what I'm supposed to do?
The page this content is going in, is all aligned to the center, and is all done with static relative posotioning.

thanks.

----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
Try something like this:
Code:
/* These rules make sure the floats remain inside their divs */
/* See [URL unfurl="true"]http://www.positioniseverything.net/easyclearing.html[/URL] */
.picbox1:after, .picbox2:after {
    content: "."; 
    display: block; 
    height: 0; 
    clear: both; 
    visibility: hidden;
}

/* Hides from IE-mac \*/
* html .picbox1, * html .picbox2 {height: 1%;}
/* End hide from IE-mac */

/* Now the images... */
.picbox1 img {
   float: left;
   margin-right: 5px;
}

.picbox2 img {
   float: right
   margin-left: 5px;
}
Your HTML markup would then be...
Code:
<div class="picbox1">
  <img href="picture1.gif" />
  <p>This is a nice picture</p>
</div>

<div class="picbox2">
  <img href="picture2.gif" />
  <p>This one's so nice...</p>
  <p>It takes two paragraphs to describe</p>
</div>
Does that put you on the right track?

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
thanks, it makes more sense than what I had, I'll give it a go.

----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top