Centering a site for any resolution

  • rkeefover
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 28, 2008
  • Posts: 16
  • Status: Offline

Post June 30th, 2008, 4:33 pm

yah dreamweaver added it when i move the elements to where i want them. The problem then is if i remove the absolute the elements all get moved and arent placed where i want them. What other types of positioning other than absoulute could i use that would still let them be placed where i want them?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 30th, 2008, 4:33 pm

  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post June 30th, 2008, 4:37 pm

You might want to learn to do CSS without using positioning...

But to answer your question there are static, relative, and fixed. There may be more but I'm too lazy to google right now :lol:
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • rkeefover
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 28, 2008
  • Posts: 16
  • Status: Offline

Post June 30th, 2008, 4:52 pm

yah i did some reading and apparently i was using ap divs, or Absolutely Positioned divs, so as the name suggests they are absolute. I tried using regular divs but they take more work with positioning and as a graphic designer only recently learning html i'm not so good with it. I guess i need to learn more about css. Any good tutorial sites for learning to work with css styles? Here's the site i just finished: http://www.heirforce.net. It's simple but its a start, i like the positioning of the elements i just need to be able to center it for any res but it seems since i used ap elements to get them where i want them and am not sure of how to do the same placement through regular divs yet i need to study up. Thanks again for your tips!
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post June 30th, 2008, 11:15 pm

Right so if you want to center everything on the page, use the example that spork gave on the first reply in this thread ... A place I always recommend for learning CSS is http://w3schools.com ...

Otherwise if you want me to help, just show me an image of what you want to achieve and I'll give you the code and explain to you why I did what ...
Let's leave all our *plum* where it is and go live in the jungle ...
  • rkeefover
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 28, 2008
  • Posts: 16
  • Status: Offline

Post July 1st, 2008, 12:07 am

Well his original code idea wont work because the elements are absolutely positioned, so using a div wrap that centers everything doesn't work when the absolute positioning of the individual elements overides it. Otherwise it would work just fine.
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post July 1st, 2008, 12:10 am

okay but Absolutely Positioned divs will never be in the center ...
Let's leave all our *plum* where it is and go live in the jungle ...
  • rkeefover
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 28, 2008
  • Posts: 16
  • Status: Offline

Post July 1st, 2008, 12:17 am

Yes and therin lies my problem. Dreamweaver made them absolute when I positioned them because thats the type of div it used. If I remove it or change the type of positioning I lose where all of my elements are placed. If i understood how to use css with images better (i can use it decently with text, but am still learning to use the css formatting to place images effectively) i could place them where i wanted them without the apdivs (Absolute positioned divs that dreamweaver makes), but as for now if I want them positioned where they are on the page, I have to leave them absolute or the I lose the positioning.
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post July 1st, 2008, 12:21 am

well then I don't see how you're going to center the whole page ... the only way I see it is to redo it unfortunately ... which sucks quite a bit ... but we will all be glad to help if you get stuck I'm sure ...
Let's leave all our *plum* where it is and go live in the jungle ...
  • rkeefover
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 28, 2008
  • Posts: 16
  • Status: Offline

Post July 1st, 2008, 1:06 am

Question. If i changed the absolute property of each element to fixed, would that be subject to the centering wrap? Or does a fixed element not allow a center formatting either?
  • righteous_trespasser
  • Scuffle
  • Genius
  • User avatar
  • Joined: Mar 12, 2007
  • Posts: 6228
  • Loc: South-Africa
  • Status: Offline

Post July 1st, 2008, 1:15 am

Actually ... I never use it ... ever ... I only use them either without specifying the position attribute or I use float or relative ... that's all ... hope someone else reads this and knows the answer ...
Let's leave all our *plum* where it is and go live in the jungle ...
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post July 1st, 2008, 8:06 am

Last time I've actually used positioning for anything was like 3+ months ago so I probably forgot a lot about positioning rules. I used to be good at it :(
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • ScienceOfSpock
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Jul 06, 2004
  • Posts: 1890
  • Loc: Las Vegas
  • Status: Offline

Post July 1st, 2008, 9:49 am

Actually, because of inheritance, you can use absolutely positioned elements properly inside other elements as long as you specify positioning on the parent element.

The reason your page isn't working properly is because absolute positioning is actually not as absolute as some people think it is. It is actually absolute, relative to the next higher parent element that has positioning specified. In your code, you are wrapping everything in apDiv25, and all the divs inside of that are absolutely positioned. Because your apDiv25 doesn't have any explicit positioning, the divs inside it look to the next highest element in the hierarchy for guidance. In this case, they are using the body element and positioning themselves from there.
Simply adding position:relative to you apDiv25 will fix that problem. The "default" positioning for any element in a page is relative, but unless it is explicitly specified in css, it won't be used to calculate the position of absolute elements.

See this example:
http://kgreene.com/divtest.html view the source.
  • rkeefover
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 28, 2008
  • Posts: 16
  • Status: Offline

Post July 1st, 2008, 10:23 am

Wow! He's exactly right :) That worked perfectly. That was way easier than having to reposition everything, you rock man.
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post July 1st, 2008, 4:19 pm

:lol: Wow, thanks. That helped even me... I used some positioning on some of my divs on my redesign of wedevoy.com and everything looks how I want it to be :) Thanks so much ScienceOfSpock... I will keep that in mind
"Bring forth therefore fruits meet for repentance:" Matthew 3:8

Post Information

  • Total Posts in this topic: 29 posts
  • Users browsing this forum: No registered users and 127 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.