relative positioning ...

liunx

Guest
Okay I'm having a little trouble with "relative" positioning of a picture. I positioned the background so that it repeats vertically straight in the middle no matter what resolution that you're viewing it in and I used this code in my CCS:<br />
body {background-image: url(coldback.jpg); background-repeat: repeat-y; background-position: top center; background-color: #000000;}<br />
<br />
So how do I line up my main image (not in the background) in the center as well? I want it to be "top center" too but I can't figure out the code. Whenever I try I always get a gap right above the picture and I don't want that. I want it to be 0px from the top. I hoping I'm explaining this well.<br />
<br />
Help? <br />
:confused:<!--content-->What about the margin?<br />
<br />
<style type="text/css"><br />
<br />
BODY {<br />
margin: 0px 0px 0px 0px;<br />
font-family: verdana, arial, helvetica;<br />
background-image: url(layout/sfeerstrook/site_home.jpg);<br />
background-repeat: no-repeat; <br />
font-size: 14px;<br />
font-color: #000000;<br />
color: #000066;}<br />
</style><br />
<br />
:rocker:<!--content-->Having a gap isn't the only problem; I need it so that it's "top center" just like the background, and no matter what resolution you're using you can see it aligned correctly on the page. If I use absolute positioning by pixels it won't show up correctly unless on a certain resolution. I guess that's my main problem.<!--content-->Can you upload this page as testpage.html?<br />
<br />
:rocker:<!--content-->okay it's right here:<br />
<!-- m --><a class="postlink" href="http://aphoria.org/coldplay.htm">http://aphoria.org/coldplay.htm</a><!-- m --><br />
<br />
That's what it looks like now but I want the main image to line up with the background regardless of the resolution. I want some way to have the "main" image be "top center" just like I have the background.<!--content-->Your code makes no sense to me at all. First, CSS must go in the head (unless it is inline).<br />
<html><br />
<head><br />
<title>Title</title><br />
<style type="text/css"><br />
<!--<br />
style<br />
.<br />
.<br />
//--><br />
</style><br />
</head><br />
<body><br />
Hello world<br />
</body><br />
</html><br />
Make sure that you follow that basic outline.<br />
<br />
Second, your CSS isn't even close to valid.<br />
body {<br />
body,p,td {font-family:arial; font-size:11px; color:#F3E2C4; <br />
<br />
scrollbar-arrow-color: CE8E68;<br />
<br />
scrollbar-track-color: 000000;<br />
<br />
scrollbar-face-color: 000000; <br />
<br />
scrollbar-shadow-color: #CE8E68;<br />
<br />
scrollbar-highlight-color: #000000;<br />
<br />
scrollbar-darkshadow-color: #CE8E68;<br />
<br />
scrollbar-3dlight-color: #CE8E68; }<br />
As far as I know, you cannot nest CSS statements. You are also missing the "#" in front of some of the colors, but not all of them. The "#" must be there. If you declare the font family and size in the body, it will be inherited by all elements within the body, so you only need to specify the "p" and "td" fonts when they are different from the body. So the above can be cleaned up to look like this:<br />
body { font-family:arial; <br />
font-size:11px; <br />
color:#F3E2C4;<br />
scrollbar-arrow-color: #CE8E68;<br />
scrollbar-track-color: #000000;<br />
scrollbar-face-color: #000000; <br />
scrollbar-shadow-color: #CE8E68;<br />
scrollbar-highlight-color: #000000;<br />
scrollbar-darkshadow-color: #CE8E68;<br />
scrollbar-3dlight-color: #CE8E68; }<br />
In your "a" elements, you have some funky stuff, too. Again, you must have the "#" in front of the hex number that represents a color. I've never heard of the filter attribute, but I'll leave that alone. In your height attributes, you have a value of "1". One what? px, em, or pt? You need to specify. A:hover is missing the "cursor:" in front of the word "default;" So:<br />
A:link { color:#CE8E68;<br />
text-decoration:none;<br />
cursor:default;<br />
filter:shadow(color=F3E2C4,offX=1,offY=1);<br />
height:1em; }<br />
<br />
A:visited { color:#CE8E68;<br />
text-decoration:none;<br />
cursor:default;<br />
filter:shadow(color=F3E2C4,offX=1,offY=1);<br />
height:1em; }<br />
<br />
A:active { color:#CE8E68;<br />
text-decoration:none;<br />
cursor:default;<br />
filter:shadow(color=F3E2C4,offX=1,offY=1);<br />
height:1em; }<br />
<br />
A:hover { color:#F3E2C4;<br />
text-decoration:none;<br />
cursor: default;<br />
border-bottom: dashed 2px #CE8E68; }<br />
After the "a" elements, you have another body element. That should be combined with the previous body. You also need to put the url in quotes.<br />
body { font-family:arial; <br />
font-size:11px; <br />
color:#F3E2C4;<br />
background: #000000 url("coldback.jpg") repeat-y top center;<br />
scrollbar-arrow-color: #CE8E68;<br />
scrollbar-track-color: #000000;<br />
scrollbar-face-color: #000000; <br />
scrollbar-shadow-color: #CE8E68;<br />
scrollbar-highlight-color: #000000;<br />
scrollbar-darkshadow-color: #CE8E68;<br />
scrollbar-3dlight-color: #CE8E68; }<br />
Putting it all together, your CSS now looks like this:<br />
<style type="text/css"><br />
<!--<br />
body { font-family:arial; <br />
font-size:11px; <br />
color:#F3E2C4;<br />
background: #000000 url("coldback.jpg") repeat-y top center;<br />
scrollbar-arrow-color: #CE8E68;<br />
scrollbar-track-color: #000000;<br />
scrollbar-face-color: #000000; <br />
scrollbar-shadow-color: #CE8E68;<br />
scrollbar-highlight-color: #000000;<br />
scrollbar-darkshadow-color: #CE8E68;<br />
scrollbar-3dlight-color: #CE8E68; }<br />
<br />
A:link { color:#CE8E68;<br />
text-decoration:none;<br />
cursor:default;<br />
filter:shadow(color=F3E2C4,offX=1,offY=1);<br />
height:1em; }<br />
<br />
A:visited { color:#CE8E68;<br />
text-decoration:none;<br />
cursor:default;<br />
filter:shadow(color=F3E2C4,offX=1,offY=1);<br />
height:1em; }<br />
<br />
A:active { color:#CE8E68;<br />
text-decoration:none;<br />
cursor:default;<br />
filter:shadow(color=F3E2C4,offX=1,offY=1);<br />
height:1em; }<br />
<br />
A:hover { color:#F3E2C4;<br />
text-decoration:none;<br />
cursor:default;<br />
border-bottom: dashed 2px #CE8E68; }<br />
//--><br />
</style><br />
Now, for some reason, in your body tag, you have specified a background color. That will over-ride your CSS, so take it out.<br />
<br />
To position your image absolutely, but still make it move on a screen resize, you can use percentages. Oh, and get rid of those "font" tags. Please, please, please do not use those when you are already using CSS. It defeats the purpose. You should also move those inline styles up to the style in the head and call them with a class or id.<!--content-->I have used the css of doogxela<br />
<br />
and the margin set to 0px<br />
<br />
see the attachment.<br />
No gap at the top.<br />
<br />
//// take this part out of my code<br />
REVIHSSHIVER_bestanden/<br />
(it is a dir on my computer)<br />
////<br />
<br />
<br />
:rocker:<!--content-->peter looks like you forgot to attach it ;)<!--content-->Originally posted by leoo24 <br />
peter looks like you forgot to attach it ;) <br />
<br />
:confused: ja ja.....getting older :D <br />
<br />
ok here it is<br />
<br />
:rocker:<!--content-->
 
Back
Top