html question
- Started
- Last post
- 16 Responses
- epigraph
i have a div that I want to center vertically, and scale horizontally in the browser window.
If I set it to a percent width, the distance between the div and browser window changes when scaling.
is there any html/css that can make it do this while maintaining a certain pixel distance from the browser window on the left and right?
Thanx
- flyingnowhere0
margins
- width: 100%;
with margins on the body?flyingnowhere - <version3
- +1
wwfc
- width: 100%;
- 7point340
i'm thinking you'd have to get javascript involved but perhaps i'm not understanding completely
- ********0
or padding
- epigraph0
I tried setting width to 100% and margins to 50px and I only get margins on the left, and a horizontal scrollbar....
- spmitch0
body {
padding:0;
margin:0;
border:none;
text-align: center; /* for old IE versions */
}#content_wrapper {
width: 100%;
margin: 0 auto;
overflow: hidden;
}
- spmitch0
just change the padding
- ********0
if your container div is fixed width, use the following method:
eg. if you had a div which is 300px x 200px ...
1. (position your div....) 'top: 50%; left: 50%'
2. (pull the div backwards & upwards, so that it's centered) 'margin-top: -100px; margin-left: -150px'- you can use the same technique with %; just specify yr width and margins in % instead of px********
- you can use the same technique with %; just specify yr width and margins in % instead of px
- epigraph0
thanks, easy enough =)
- OSFA0
Quick question, If I create a 4 page mini-site and want to have music playing, can this be done so that the mp3 plays on all pages as background music? Without any controls or player visible of course... I was able to embed it to the index page but as soon as I go to the next page the song stops. Please? I'm helping a buddy out with a romantic gift... hehe Thanks!
- sounds like frames or an ssi include file would be your solution7point34
- Frames.... or a popup... or show/hide the different pages like they were tabs so it's 4 for the price of 1acrossthesea
- no********
- FLASH! AHHHAHHHH! It'll save every sub page of yours!shitehawke
- I have no idea what you guys said...
OSFA - dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dum dumshitehawke
- FLASH!shitehawke
- You could use JQuery or something to load content in to a single index file. Or just use old fashioned iFrames.detritus
- ********0
OSFA - load content into divs instead of refreshing the page - job done
- monospaced0
that's what html is?
- since when does html monkey make you a designer?monospaced
- OSFA0
how about just playing it on the index page without any controls or players visible then... fuck that! I'm not messign with frames, etc...
- ********0
OSFA - have hidden divs with all the 4 pages content in - then the nav bar would just show/hid the content in each div. then the player would play regardless of what content is viewed as the page never refreshes...
- would have to do some extra work to be able to externally link to them individually thoughacescence
- doubt he needs that********
- Gordy220
OSFA - I used this the other day. Pretty simple to implement.
- ItTango0
Flash. Done. Now about the romance...
- detritus0
If it's 'just' a gift - why not just use iFrames?
Who cares if it's valid, contemporary, markup?
- + a billionflashbender
- why would iframes be quicker/easier than divs?********
- no javascript, no redesign7point34
- how are divs, sans JS library easy to load content in to, for a non coder?detritus