Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

52 users online



CSS positioning

CSS positioning

Currently viewing this thread: 1 (0 members and 1 guests)


Page 1 out of 2
SolidCell

SolidCell

I use Photoshop and like to help out the new guys
Status: Offline!

CSS positioning

i know that i can say left:50%; but whats the percent even out of? (what's 100%?) My actually question is: how can i get my layout, pretty much a rectangle, to always pop up in the middle of the viewer's screen? So that rez, screen size, etc. won't affect it.

___________________

Signature Rules

Cloud-

Cloud-

19, going to college. Blah blah blah
Status: Offline!

100% would be the width of a person's screen. Say you wanted a box that was 60% of the screen. So you'd set the margins to 20% on either side of your "box" and then set its width to 60%.

___________________

http://www.creativefx.net/images/banner15.jpg
Tutorials - Gallery - Forum - Coming Soon!

James

James

Development Forum Leader
Status: Offline!

I always thought the percentage amount is the percent within the container. So if you have a DIV with a width of 200px and another DIV inside of it set to 90% width, the nested DIV would be 90% of 200px.

___________________

irc.efnet.net #neverside
Neverside merchandise!

Dan1

Dan1

TF Retiree
Status: Offline!

Well, the actual screen is 100%. Now, if you have an element that's 60% wide, you add a 20% margin-left on to center it. Now, if you have an 80% div with a 50% div inside it, it's now only 40% of the total width. This would be relative positioning (default) if I am correct. Absolute positioning would make the inner div 50% of the page, as if the containing one was non-existant.

Apoc, in your case, since the 200px is inside the 90%, it makes no difference. If it's vice versa, then of course it's 90% of 200px.

SolidCell

SolidCell

I use Photoshop and like to help out the new guys
Status: Offline!

but the percentage of the screen that my image takes up will be relative to the percentage on someone else's screen or what? because I would like it to always be in the middle.
My actually scenario (just said img to shorten it) is that i have a site that is 496x262 and my screen rez is 1152x864). How do i figure out how much 'percentage' it is accoriding IE?

___________________

Signature Rules

Dan1

Dan1

TF Retiree
Status: Offline!

Well, if you're using pixel values, it's impossible to generate percentages. Just throw everything in a div using text-align: center;..

Cloud-

Cloud-

19, going to college. Blah blah blah
Status: Offline!

Not necessarily. Like fredmv provided in my thread that's around here somewhere, you can reference different style sheets or even pages if you want to adjust for different resolutions. So if you figure out the percentages for each resolution you'd probably be able to do that.

___________________

http://www.creativefx.net/images/banner15.jpg
Tutorials - Gallery - Forum - Coming Soon!

SolidCell

SolidCell

I use Photoshop and like to help out the new guys
Status: Offline!

hey Dan the text-align: center worked for positioning it horizontaly (and it stayed in the middle as i resized the window!), but what would i use to position it vertically?

___________________

Signature Rules

Cloud-

Cloud-

19, going to college. Blah blah blah
Status: Offline!

Depends on how far you want it to be from the top. You can either use padding-top on the body or use margin-top on your div tag that you're trying to position.

___________________

http://www.creativefx.net/images/banner15.jpg
Tutorials - Gallery - Forum - Coming Soon!

Dan1

Dan1

TF Retiree
Status: Offline!

Try vertical-align:;. However, Cloud-'s method will also work, depending on what you're getting at.

Page 1 out of 2
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0074 seconds.