Forum Moderators: not2easy
It's for an ordinary family website, where the photos vary in width from 300px to 450px and the photos are alternatively aligned left and right vertically, with the text about the photo next to it with a little gap, (perhaps 5px), but no matter what happens, I can't seem to get the text to go next to the photo ;-(
Because theres many, many pages, I would like to do as much as poss in css.
This is what I've done so far:
<CENTER>
<TABLE>
<TBODY>
<TR>
<TD>
<P class=maintextright>sample text</P>
</TD>
<TD>
<img border="0" src="index.1.jpg" align="right">
</TD>
</TR>
</TBODY>
</TABLE>
</CENTER>
<CENTER>
<TABLE>
<TBODY>
<TR>
<TD>
<img border="0" src="index.2.jpg" align="left">
</TD>
<TD>
<P class=maintextleft>sample text</P></TD>
</TR>
</TBODY>
</TABLE>
</CENTER>
<CENTER>
<TABLE>
<TBODY>
<TR>
<TD>
<P class=maintextright>sample text</P></TD>
<TD>
<img border="0" src="index.3.jpg" align="right"></TD>
</TR>
</TBODY></TABLE></CENTER>
And in the ext stylesheet:
BODY {
FONT-WEIGHT: normal; MARGIN: 22px 12px 18px; COLOR: #000080; LINE-HEIGHT: 250%; FONT-STYLE: normal; FONT-FAMILY: arial, tahoma, verdana, helvetica, sans-serif; BACKGROUND-COLOR: #000080
}
TABLE {
BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #ffffff 1px solid; VERTICAL-ALIGN: top; BORDER-LEFT: #ffffff 1px solid; WIDTH: 95%; BORDER-BOTTOM: #ffffff 1px solid; BACKGROUND-COLOR: #ffffff; bordercolor: #ffffff; align: center; cell-padding: 18px
}
.maintextleft {
FONT-WEIGHT: normal; FONT-SIZE: 14px; LINE-HEIGHT: 140%; TEXT-ALIGN: left; padding: 20px;
}
.maintextright {
FONT-WEIGHT: normal; FONT-SIZE: 14px; LINE-HEIGHT: 140%; TEXT-ALIGN: right; padding: 20px;
}
Any help very much appreciated and if I haven't explained it clearly enough,please let me know.
This is the setup css:
.table { width:60%; margin:auto;}
.td1 { width:30%; text-align:left; padding:1em; border-bottom:1px solid;}
.td2 { width:30%; text-align:right; padding:1em; border-bottom:1px solid;}
This is the alternating cell in table html:
<table class="table">
<tr>
<td class="td1"><h2>Title</h2>
<div>Some sub text<br><br></div>
<div>Some body text pertaining to the photo.</div></td>
<td class="td2"><img src="path to your image" height="200px" width="202px"></td>
</tr>
<tr>
<td class="td1"><img src="path to your image" height="200px" width="202px"></td>
<td class="td2"><h2>Title</h2>
<div>Some sub text<br><br></div>
<div>Some body text pertaining to the photo.</div></td>
</tr>
</table>
Note that this is a setup for a specific site, which needs the padding and the bottom-border line.... Also note that on the specific site, the table is centered through a css <div> (not shown above) because of some wonkiness amongst the various browsers.