noob simple html Q
- Started
- Last post
- 15 Responses
- indian_pole
hi guys. sorry, i am a print designer, just need to upload a simple temporary 'under construction image to a site'
what am i doing wrong to get this image to center vertically on the page??
- Sinov0
It works in Firefox ;)
- vaxorcist0
old school non-official table code... just in time to piss off the CSS freaks! whoo hoo!
<table><TR><Td><center>
<img src="under-construction.gif">
</center></td></tr></table>
- indian_pole0
not to be a complete tard but could some nice person tell me exactly where to put the code? like i say, html is gibberish to me!
- vaxorcist0
<html>
<head><title>come back soon!</title></head>
<body>... code here...
</body>
</html>- you underestimate my stupidness. see now: http://www.csbutcher…indian_pole
- oops http://www.csbutcher…indian_pole
- orrinward0
If you know the height and width of the box:
Give HTML and Body height 100% (with a CSS reset so there's no unnecessary padding).
html, body {
margin:0;
padding:0;
width:100%;
height:100%
}#container{
position:absolute;
top:50%;
left:50%;
margin-left:-(half the width);
margin-top:-(half the height);
}
- orrinward0
That CSS goes in either a css file and link to it in the page, or in <style> tags.
<style type="text/css">
html, body {
margin:0;
padding:0;
width:100%;
height:100%
}
#container{
position:absolute;
top:50%;
left:50%;
margin-left:-(half the width);
margin-top:-(half the height);
}
</script>
</head>
<body>
<div id="container">
ALL YOUR SHIT GOES HERE
</div>
</body>
- vaxorcist0
RE: Not knowing where to put the code...
You could mean:1. where on the server?
(usually www or htdocs or public_html folder)2. where in the text of the HTML file?
if you're using CSS, all style code like orrinward quotes above either has to be wrapped in <style> ... code here </style> or included in a separate file like
<link rel="stylesheet" type="text/css" href="style.css" >
where style.css is the code that orrinward gave you,
then your HTML code references it like:<div id="container">
<img src="under-construction.gif">
</div>
- vaxorcist0
oh... didn't see your comment above...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Campbell & Sons</title></head>
<body>
<table width="100%" height="100%">
<TR><Td><center>
<img src="cstemp.gif">
</center></td></tr></table>
</body>
</html>
- vaxorcist0
cut out the doctype line, it will work then, not very official code, but this is just a placeholder anyway...
<html>
<head><title>Campbell & Sons</title></head>
<body>
<table width="100%" height="100%">
<TR><td><center>
<img src="cstemp.gif">
</center></td></tr></table>
</body>
</html>
- indian_pole0
ok thanks guys. i've basically centered it, now i can;t get my background colour to work again:
http://www.csbutchers.co.uk/TEST…
what have i cocked up?- ok sorted it. i'm sure this code is wrong practice but screw it!indian_pole
- intVal0
it should be forbiden to post code on this forum.
- vaxorcist0
kludge-o-matic 1996 code...
<body bgcolor="#AFAFA">
or whatever your HEX color you sample in photoshop is...
- akrok0
<html>
<head><title>Campbell & Sons</title></head>
<body>
<don't post code, here>
<TR><td><center>
<or intVal will start crying>
</center></td></tr></table>
</body>
</html>
- vaxorcist0
or at least code this kludgey.... I confess to liking 1996 html...