Вопрос

So, I'm working with squarespace (a WYSIWYG page creator), but I'm attempting to use some custom CSS to create this. Unfortunately, this is happening instead. Here's the code live on jsfiddle.

I'm trying to push my whole page 300 pixels in to the right, because at the moment the code below doesn't do that--it collides with the background and overlaps the other text on the left. I can't just use the body style -- because that affects the entire rest of the page I'm building in, and will shift that to the left. Instead, I'm trying to do it just by offsetting the three frames (framecontentLeft, framecontentRight, and mainContent).

I'm also trying to center these frames in the page horizontally (the same way that the page you're looking at is centered) but again, I can't change the body style. So I'm thinking it's going to be a hack, but every time I try to use relative positioning to change the locations of the frames, I get nothing or it bugs out and stacks the frame in normal flow, vertically, on the left side of the page.

Could anyone help me figure out how to do this? I'll give you the key to the city...

<!--Force IE6 into quirks mode with this comment tag-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dynamic Drive: CSS Left and Right Frames Layout</title>
<style type="text/css">



body{
    margin-top:0px;
    margin-left:0px;
    position:absolute;
    top:0; left:0; bottom:0;right:0;
    left: 0%;
    font-family:Helvetica;
    overflow: hidden; 
}

#framecontentLeft, #framecontentRight, #maincontent{
    position:absolute;
    top:0;
    height:1000%;
}
#framecontentLeft,#framecontentRight{
    overflow:hidden;
}
#framecontentLeft{

    left: 200; 
    width: 500px; /*Width of left frame div*/
    top: 20px;
}

#framecontentRight{
    position:relative;
    top: 0px;
    left: 750px;
}

#maincontent{
    left: 250px; /*Set left value to WidthOfLeftFrameDiv*/
    right: 300px; /*Set right value to WidthOfRightFrameDiv*/
    bottom: 0px;
    top: 100px;
    width: 500px;
    line-height: 1.5;
}

.innertube{
    margin: 15px; /*Margins for inner DIV inside each DIV (to provide padding)*/
}
.centered{
    text-align = centered;
}

* html body{ /*IE6 hack*/
    padding: 0 150px 0 200px; /*Set value to (0 WidthOfRightFrameDiv 0 WidthOfLeftFrameDiv)*/

}

* html #maincontent{ /*IE6 hack*/
    height: 100%; 
    width: 1000%; 
}

</style>



<script type="text/javascript">
/*** Temporary text filler function. Remove when deploying template. ***/
var gibberish=["This is a test page for a gym", "We wholly believe in the art of strength", "Ipso liptum facto freako."]
function filltext(words){
for (var i=0; i<words; i++)
document.write(gibberish[Math.floor(Math.random()*3)]+" ")
}
</script>


</head>

<body>

<img src="abelinebanner.png" width="1000" height="100" />

<Font face = "helvetica">

<div id = "pagediv">
<div class = "innertube">

<div id="framecontentLeft" class = "centered">
<div class="innertube">

<table width="100%" height="100%" cellpadding="3" cellspacing="0" border="0">
<tr><td align="left" valign="top">
<br />
<br />
<br />


</td></tr>
<tr><td align="left" valign="top">
<tr><td align="left" valign="top">
<br />
<br />
<iframe width="200" height="200" src="http://www.youtube.com/embed/RR62QMlvI60" frameborder="0" allowfullscreen></iframe>


</td></tr>

<tr><td align="left" valign="top">
<tr><td align="left" valign="top">
<br />
<br />
<iframe width="200" height="200" src="http://www.youtube.com/embed/TVNfjPWzS70" frameborder="0" allowfullscreen></iframe>


</td></tr>

<tr><td align="left" valign="top">
<br />
<br />

<iframe width="200" height="200" src="http://www.youtube.com/embed/iLn-aSGs7VY" frameborder="0" allowfullscreen></iframe>


</td></tr>
</table>

</div>
</div>

<div id="framecontentRight"  class = "centered">
<div class="innertube">


<table width="100%" height="100%" cellpadding="3" cellspacing="0" border="0">
<tr><td align="left" valign="top">

<iframe width="200" height="200" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=2110+Pine+St.+Abilene,+TX+79601&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=77.57349,131.132813&amp;ie=UTF8&amp;hq=&amp;hnear=2110+Pine+St,+Abilene,+Texas+79601&amp;t=m&amp;z=14&amp;ll=32.473249,-99.731684&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=2110+Pine+St.+Abilene,+TX+79601&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=77.57349,131.132813&amp;ie=UTF8&amp;hq=&amp;hnear=2110+Pine+St,+Abilene,+Texas+79601&amp;t=m&amp;z=14&amp;ll=32.473249,-99.731684" style="color:#0000FF;text-align:left">View Larger Map</a></small> <br />
Art of Strength Abilene <br />
Hendrick Heatlh Club <br />
2110 Pine St. Abilene<br />
TX 79601 <br />

 </td></tr>
<tr><td align="left" valign="top">


<h2> Contact Us:</h2>
Phone : (325) 670-7682 <br />
Email : abeline@aos.com <br />
Website : Link

</td></tr>


<tr><td align="left" valign="top">
<br />
<br />
<img src="ropes2.jpg" width="160" height="600" />


</td></tr>





</table>

</div>
</div>


<div id="maincontent"  class = "centered">
<div class="innertube">
<table width="100%" height="100%" cellpadding="3" cellspacing="0" border="0">
<tr><td align="left" valign="top">

<p><script type="text/javascript">filltext(10)</script></p>


</td></tr>
<tr><td align="left" valign="top">

<h1>About Our Training</h1>
<p><script type="text/javascript">filltext(10)</script></p>
<img src="abilene.jpg" width="307" height="243" />


</td></tr><tr><td align="left" valign="top">

<h1>Staff</h1>
<p><script type="text/javascript">filltext(10)</script></p>


</td></tr>
</table>

</div>
</div>

</div>
</div>

</FONT>
</body>
</html>
Это было полезно?

Решение

After analyzing this, there is no straight forward fix. Simply adding padding does not help.

So what can you do?

You need to change the design altogether. It should be fairly easy to fix (meaning in half an hour or so).

Create a 3 column table layout and put the stuff in the columnn. That means you have to rearrange stuff. What I see so far, the elements are not properly nested, what is why Fixed Positioning is used to make it look right. You have to reorder the contents, remove the Fixed position as much as you can. It should simply be copy and past. you need a good editor for this that will make life a lot easier!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top