2 replies [Last post]
bogus
bogus's picture
Offline
Regular
Last seen: 10 years 25 weeks ago
Timezone: GMT-5
Joined: 2006-12-04
Posts: 47
Points: 3

New here. Have 3 questions. Well I hope someone can help me Smile
1) Is there a way to center something that you put in a div to be a vertical center - picture or text - I can't find way to do it and vertical-align: middle
doesn't do any good.
2) how do I do make fixed frame like on this page
http://www.csszengarden.com/?cssfile=069/069.css
I think about black frame surrounding page
3) If I have a picture let's say 800x600 pixels, and I want to use it for a page background (just once shown on whole background - from edge to edge) but I want it to be full in background whatever resolution of computer is - can I do that?

Thank you very very much.

bo·gus (bō'gəs)
adj.
Counterfeit or fake; not genuine: bogus money; bogus tasks.
[From obsolete bogus, a device for making counterfeit money.]

vinhboy
vinhboy's picture
Offline
Enthusiast
davis, ca
Last seen: 11 years 42 weeks ago
davis, ca
Joined: 2006-12-21
Posts: 257
Points: 0

1) You can use something

1) You can use something like this:

position: relative; top: 50%; Actually I am not sure if this is suppose to be position: relative or position: absolute.

2) They use this:

#extraDiv4 { background-image: url(edge_left_black.gif); background-repeat: repeat-y; position: fixed; top: 0; left: 0; width: 20px; height: 100%; margin: 0; }

The important thing is "position:fixed;" and the top and left assignment.

3) I don't think so. But everything else you want to do can had here: http://www.w3schools.com/css/css_background.asp

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 7 years 42 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

For (1), If you know the

For (1), If you know the height of the div (in units other than %) you can set line-height to that height and then use vertical-align: middle.

For (2), learn to use your browser. Check the source with the view source facility. Find the CSS file uri and view it in your browser too. Better still use the Web Developer facilities of Firefox to View CSS. Then look at how they did it.

For (3). Place an image in a div in the body. Position the div absolutely and set it to 100% height and 100% width. Give it a negative z-index to locate it behind everything on the page. Set the image height and width to 100%. Place all the content in another div in the body - set this div to overflow auto or scroll. html, body and the content div will all need both width and height set to 100%.