This is a discussion on "collapsing page margins" within the Starting Out section. This forum, and the thread "collapsing page margins are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
collapsing page margins
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
collapsing page margins
Hi,
I've looked around the site for this topic but I can't find it anywhere. Sometimes I like to create a page/site which doesn't use up all of the horizontal space at a resolution of 1024x768. It has an equal margin on both sides. I would like to learn how to do something that I often see on the web. Say you have a browser window which is not maximised but it almost fills the screen. Grab hold of the right hand border and gradually narrow the window. The left hand margin disappears until the left of the window hits the centrally placed content, as you continue to narrow the window the left margin begins to dissapear. Only once both margins have gone do you get a horizontal scrollbar. I think this is a really good bit of functionality but I have no idea how it is done. Could anyone help me or push me in the direction of a resource that can? Many thanks Paul |
|
|
|
#2
|
|||
|
|||
|
Re: collapsing page margins
I also love these flexible layouts
http://www.badmintonbible.com Would you be happy with those kinds of collapsing margins? |
|
#3
|
|||
|
|||
|
Re: collapsing page margins
Hi Mike,
That is a great site but it isn't quite what I was meaning. What I was wanting is much simpler, I hope Thanks for showing me the site. |
|
#4
|
|||
|
|||
|
Re: collapsing page margins
I'm not sure how to make one margin disappear first (nor is this desirable, usually). But I can show you how to make the margins collapse together.
First, put your content in a containing <div id="content">. Second, use CSS to set your <div> width in either px or em. Using % won't work. Third, centre your site by applying margin: 0 auto; to the <div>
|
|
#5
|
|||
|
|||
|
Re: collapsing page margins
Thanks Mike really appreciate that. I will try it out.
|
|
#6
|
|||
|
|||
|
Re: collapsing page margins
Let me know how you get on!
|
|
#7
|
|||
|
|||
|
Re: collapsing page margins
That worked a treat Mike and such small piece of code. The site is not on the server yet.
Thanks for your help, really appreciate your time. Paul Rich |
|
#8
|
|||
|
|||
|
Re: collapsing page margins
Quote:
|
|
#9
|
|||
|
|||
|
Re: collapsing page margins
For older browsers use
Pete. |
|
#10
|
|||
|
|||
|
Re: collapsing page margins
Thanks pa007,
Which older browsers would you use that for, ie5x? or are you including ie6 in that. I'm always a bit confused as to what to test with. I have firefox and ie7 on my desktop and ie6 on my laptop. This means I pretty much ignore ie5x but I wouldn't think these days that would be too much of an issue. I know it's important to be as inclusive as possible when designing but you have to be practicle too. Appreciate your help. Paul R |
|
#11
|
|||
|
|||
|
Re: collapsing page margins
If I remember rightly that is for ie6. ie7 is ok I think, though I wouldn't know as I always include the extra code. But it's still something worth bothering with, definitely.
Glad I could help. Pete. |
|
#12
|
|||
|
|||
|
Re: collapsing page margins
It's only necessary for IE6 if you trigger quirks mode.
|
|
#13
|
|||
|
|||
|
Re: collapsing page margins
Ah so that's why. I always did wonder. I basically just did it because when I made my first fixed width centred layout with css, I was told to. I won't anymore, thanks for the heads up.
Pete. |
|
#14
|
|||
|
|||
|
Re: collapsing page margins
Quote:
IE6 rendering in quirks mode = IE5 rendering. |
|
#15
|
|||
|
|||
|
Re: collapsing page margins
Well, I must admit IE 5 only gets a brief look as regards cross browser compatibility. Depends on the project but I never go too far out of my way to support IE 5, that said I've never had any major problems. I just wish they would ban IE 5, it would make life easier.
Pete. |
|
#16
|
|||
|
|||
|
Re: collapsing page margins
Quote:
|
![]() |
| Tags |
| margin |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Margins in IE are different than Firefox | KiwiTaicho | Web Page Design | 3 | Sep 28th, 2007 14:57 |
| Margins need fixing | notagz1 | Starting Out | 9 | May 28th, 2007 14:03 |
| What's up with margins and padding in IE? | Donny Bahama | Web Page Design | 41 | Apr 19th, 2007 10:04 |
| ff margins | Dapandyman | Web Page Design | 10 | Feb 12th, 2007 23:03 |
| body margins | benbacardi | Web Page Design | 2 | Apr 10th, 2004 14:51 |