|
Hi,
Hope you can help.
First I tried to place 4 div side by side (each div holds a photo) inside a container div. No success. For the sake of simplicity in describing my challenge, I’ll refer to each of the 4 div as photos.
Then I placed 2 photos inside a container div, 2 photos inside another container div and both div with the photos inside a master container div. So I’ve ended up with 4 photos (2 div + 2 div) side by side.
My overall aim is to:
A) have the photos line up attractively in various screen sizes (eg: 1024 by 768; 1280 by 720; 1280 by 768; 1280 by 800)
B) have no horizontal scrollbars if a viewer has a 1024 by 768 screen size
The challenge:
To center the photos so that the distance between the sidebars and the left and right hand side photos remain the same in various screen sizes.
The problem with position: absolute is that the sidebars cover the photos when the window is resized with the mouse. Any ideas will be appreciated.
PS. Finding your site has been a big help; I’ve discovered a lot about CSS since I discovered it.
The HTML code:
<div id="main">
<div id="content">
<div id="bothgalleryboxes">
<div id="leftgallerybox">
<div id="leftgallery1">
<a target="_blank" href="image Test 2.html"><img style="height: 150px;
width: 150px" src="Copy_Sample_Pic_01.JPEG" alt="image" /></a>
<br /><h3><a target="_blank" href="image Test 2.html">Image</a></h3>
</div>
<div id="rightgallery1">
<a target="_blank" href="image Test 2.html"><img style="height: 150px;
width: 150px" src="Copy_sample_Pic_002.JPEG" alt="image" /></a>
<br /><h3><a target="_blank" href="image Test 2.html">Image Caption</a></h3>
</div>
</div><!...leftgallerybox...>
<div id=”rightgallerybox>
<div id="leftgallery2">
<a target="_blank" href="image Test 2.html"><img style="height: 150px;
width: 150px" src="Copy_Sample_Pic_01.JPEG" alt="image" /></a>
<br /><h3><a target="_blank" href="image Test2.html">Image Caption</a></h3>
</div>
<div id="rightgallery2">
<a target="_blank" href="image Test 2.html"><img style="height: 150px;
width: 150px" src="Copy_sample_Pic_002.JPEG" alt="image" /></a>
<br /><h3><a target="_blank" href="image Test 2.html">Image Caption</a></h3>
</div>
</div><!...rightgallerybox...>
</div><!...bothgalleryboxes...>
<div id="leftsidebar">
<ul id="decoration">
<li> <a target="_blank" href="Link here.html">Click</a></li>
<li> <a target="_blank" href="I Link here.html">Click</a></li>
<li> <a target="_blank" href=" Link here.html">Click</a></li>
<li> <a target="_blank" href=" Link here.html">Click</a></li>
<li> <a target="_blank" href=" Link here.html">Click</a></li>
<li id=sidebar>Label</li>
<li> <a target="_blank" href=" Link here.html">Click</a></li>
<li> <a target="_blank" href=" Link here.html">Click</a></li>
<li> <a target="_blank" href=" Link here.html">Click</a></li>
<li> <a target="_blank" href=" Link here.html">Click</a></li>
<li id="bordercontact"> <a target="_blank" href=" Link here.html">Click</a></li>
</ul>
</div>
<div id="rightsidebar">
words
</div><!...rightsidebar>
</div><!...leftsidebar...>
</div><!...content...>
</div><!...main>
The CSS Code:
#main
{position: relative; top:0; left: 0; width: 100%; margin-top: 10px; margin-top: 10px; }
#content
{margin: 0 240px 160px; border: 1px solid black; background-color: white; color: black;}
#bothgalleryboxes
{right:0; border: 3px solid blue; width: 100%; background-color: lightyellow; margin-top: 10px; padding: 0; }
#leftgallerybox
{margin: 0 0 0 20px; float: left; border: 1px solid green; width: 340px; background-color: lightyellow; margin-top: 10px; padding: 0;}
#leftgallery1
{width: 170px; top: 0; float: left; text-align: center; line-height: 25px; background-color: lightyellow; padding: 0 }
#leftgallery1 a
{text-decoration: none; }
#leftgallery1 h3 a:hover
{font-size: x-large; text-decoration: none; background-color: yellow;}
#rightgallery1
{ float: right; top: 0; width: 170px; text-align: center; center; padding: 0 0 0 0px; line-height: 25px; background-color: lightyellow; padding: 0 }
#rightgallery1 a
{text-decoration: none}
#rightgallery1 h3 a:hover
{font-size: x-large; background-color: yellow; }
#rightgallerybox
{margin: 0 0 0 20px; float: left; border: 1px solid green; width: 340px; background-color: lightyellow; margin-top: 10px; padding: 0; }
#rleftgallery1
{ float: left; top: 0; width: 170px; text-align: center; center; padding: 0 0 0 0px; line-height: 25px; background-color: lightyellow; padding: 0 }
#leftgallery1 a
{text-decoration: none}
#leftgallery1 h3 a:hover
{font-size: x-large; background-color: yellow; }
#rightgallery2
{ float: right; top: 0; width: 170px; text-align: center; center; padding: 0 0 0 0px; line-height: 25px; background-color: lightyellow; padding: 0 }
#rightgallery2 a
{text-decoration: none}
#rightgallery2 h3 a:hover
{font-size: x-large; background-color: yellow; }
#leftsidebar
{position: absolute; top: 0; left: 0; width: 189px; margin: 0; padding: 0; border: 1px solid blue; }
#decoration
{text-decoration: none; margin: 0; padding: 0 0 0 0; background-color: #6F6146; list-style-type: none; }
#sidebar
{text-align: center; color: black; background-color: khaki; line-height: 2.5; font-family: courier new, trebuchet, sans-serif; }
#decoration li
{margin: 0; padding: 0; width: 100%; }
#decoration a
{ display: block; /* to increase clickable area as a's default to inline*/ color: #FFF; line-height: 2.5; text-decoration: none; padding: 0; border-bottom: 1px solid #FFF; height: 1%}
#decoration li a:hover
{background-color: #4F4532; }
#rightsidebar
{position: absolute; top: 0; right: 0px; width: 320px; margin: 0; padding: 0; border: 1px solid black;}
|