Forum Moderators: not2easy

Message Too Old, No Replies

Getting img floating not to inherit

         

Kysmiley

7:38 pm on Apr 11, 2004 (gmt 0)

10+ Year Member



I have most of the page working and a valid CSS file now according to W3C.org but I am not able to get my img.left to have the text line up to the left beside the image it wantes to center according to what its parent .body is doing. The only way I have figured out so far to get the img.right to have text line up on the right is to us the <align="right"> for the images and text lining up to the right. Now i have had to add a new <div> to get the logo to line up to the left but that also ment adding a .body class for the align="center".
is there any simple way to fix this short of using a .cnt { text-align: center;} class and changing the body class to not align center.
CSS coding
<body>

<div class="lf";>
<a href="http://www."><img border="0" src="pdhdsm.gif" alt="logo" width="200" height="86"></a></p>
</div>
<div class="body">
<p>
<img border="0" src="rdhd.jpg" alt="road img" width="200" height="126"><br>
<h1>test</h1><br>
<h2>"test"</h2></p><br>

<p><a href="mh.htm"><img src="P41sm.jpg" class="left" alt="City Park" syle=width: "200" height: "150"></a>
<span class="ptitl">"View from City Park"<br>somewhere</span>
<br style="clear: left"></p><hr>
<p align="right"><a href="mh1.htm"><img src="P40sm.jpg" class="right" alt="City Park" syle=width: "200" height: "150"></a>
<span class="ptitl">"View from City Park"<br>somewhere</span>
<br style="clear: right"></p><hr>
Any suggestions whould be most helpfull, mazybe someone can even help me so i dont have to use that
<p align="right"> for the right side text and image
Thanks

Nick_W

10:33 am on Apr 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about somthing like this:

.leftpic {
text-align: left;
}
.leftpic img {
float: left;
}

<div class="leftpic">
<img src="blah.jpg" alt="" />
blah blah blah
</div>

Maybe I misunderstand you, but it seems that simple... ;)

Nick

Kysmiley

10:48 pm on Apr 15, 2004 (gmt 0)

10+ Year Member



Thanks for the reply Nick i just removed the text-align: center from the parent and made a seperate class="center for when i wanted things centered and it seemed to work fin for now