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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS Layout Question

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I have been reading various tutorials about CSS layout but most only deal with the operation of single elements. I have a question about putting it all together.
Page starts with a top graphic made up of 6 images which together stretch almost across screen, forming a top banner.
The page is created dynamically and the six images are varied throughout the site although each element stays the same size but this is not the problem
The images are laid out like this:-
Code:
OO
OO
OO
I hope that makes sense.
Should I use relative positioning or absolute positioning for the divs containing the images.
I have tried both but the results are a little haywire in both cases.
I just need putting on the right track and then I can get my head round this CSS stuff.


Keith
 
Do you need any positioning for the images? Do you need to put the images in divs? You could make a div just as wide as two images, then just simply put all six images in that div. Since images are treated as inline elements, they would form the layout you describe. No need to complicate things beyond that.
 
I was hoping it was as simple as that but but the images wrap to the next line.
I must be doing something wrong - but what?
A similar problem further down the page is aligning 4 images horizintally, equally spaced.
I did it using absolute positioning but how is it done relatively?
My results up to now look like a jumbled picture quiz.

Keith
 
Depends on how things are layed out. And how you need them to be spaced out. Do you have a link where you could show us what you have so far? Or at least a code showing your approach and what the limits are.
 
For my sake, let's take it back to basics.
I am producing the HTML from within a PERL script and just want to code it as cleanly as possible.
Using the following table layout - produces the output I require.
Code:
<table class="advert03" width="100%" border="0"><tr>
<td><img border="0" src="$adGIFS[0]" alt="Advert"></td>
<td><img border="0" src="$adGIFS[1]" alt="Advert"></td>
<td><img border="0" src="$adGIFS[2]" alt="Advert"></td>
<td><img border="0" src="$adGIFS[3]" alt="Advert"></td>
</tr>
</table>
Four equally spaced images across the page, centred in the table cells by CSS from a stylesheet.
This works but can it be simplified using CSS positioning.


Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top