Jump to content


help with autoscaling backgrounds


  • Please log in to reply
4 replies to this topic

#1 Guest_edwinsweep_*

Guest_edwinsweep_*
  • Guests

Posted 21 April 2006 - 10:16 AM

hi everybody i am currently creating a website that supposed to have 2 tables with autoscaling background's in them. if somebody is viewing the site with only a 800x600 resolution the table will be less pixels aswell as if you where viewing it with 1024x768.
its just that the background in those table's wont automaticly scale.
if the table becomes less wide the background stay's its own scale and will be twice the size the table is!
is there any way to get this fixxed? either with php or css.
<?php
echo '<table class="1st" border=0 height=111 width=100%><tr><td background="/pictures/images/shwboven.jpg">1</td></tr></table>';
?>
<style type="text/css"> 
body{ 
margin:0; 
padding:0; 
} 
div{ 
width:100%; 
position:absolute; 
middle:0; 
text-align:center; 
}
table.1st{
margin-left:auto; 
margin-right:auto; 
text-align:left; 
} 
table.2nd{
margin-left:auto; 
margin-right:auto; 
text-align:left; 
} 
</style>
<?php
echo '<align><table align="right" class="2nd" border=1 height=100% width=81><tr><td>1</td></tr></table><align>';

?>
thanks in advance guys!

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 21 April 2006 - 10:30 AM

Where's the php itself? What you posted is just HTML and CSS (you can drop the echo thing and right it in pure HTML...).

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 Guest_edwinsweep_*

Guest_edwinsweep_*
  • Guests

Posted 21 April 2006 - 10:45 AM

i know i am just used to putting all the html tags into php echo function's.
(probably a bad habit).
and the php then css then php thing doesnt make any sence either, i know:)

#4 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 21 April 2006 - 11:08 AM

But my question is, how do you know what's the resolution of the user and such... Or are you asking for a script that can find it?
(Btw, I think its better with JS and not sure if PHP can do such a thing)


Orio.
Think you're smarty?

(Gone until 20 to November)

#5 Guest_edwinsweep_*

Guest_edwinsweep_*
  • Guests

Posted 21 April 2006 - 11:33 AM

*SOLVED*
i found a way to do it with css style sheet.
creating 2 layers using the bottom layer as your background and top for the rest.
<html>
<head> 
<title>SHW</title>
<style type="text/css">
body {margin:0px;}
#bg_image {
width: 100%;
height: 100%;
left: 0px;
top: 0px;
position: absolute;
z-index: 0;
}
#contents {
z-index: 1;
position: absolute;
}
</style>
</head>

<body>

<!-- this creates the background image -->
<div id="bg_image"> 
<img src="pictures/images/shwbg.jpg" style="width: 100%; height: 99%;"> 
</div>

<!-- this puts the contents of the page ontop of the background image -->
<div id="contents">
hoi
</div> 

</body>

</html>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users