CSS question
am 14.08.2007 21:32:18 von DFSI am trying to position a block in my CSS and I want it to when I resize the
browser window the margin on both sides remain the same. But I can only get
the left side to behave this way
I am trying to position a block in my CSS and I want it to when I resize the
browser window the margin on both sides remain the same. But I can only get
the left side to behave this way
DrewC wrote:
> I am trying to position a block in my CSS and I want it to when I resize the
> browser window the margin on both sides remain the same. But I can only get
> the left side to behave this way
>
>
To get the answer, please give a link to your website. It is hard to
know what does your CSS file looks like.
http://drewclayton.com/test.htm
#top2 {
padding: 10px;
border: 5px solid #ccc;
background: #666;
height: 100px; /* ie5win fudge begins */
voice-family: "\"}\"";
voice-family:inherit;
height: 46px;
width: 352px;
margin-top: 20px;
margin-right: 20px;
margin-bottom: 0px;
margin-left: 20px;
position: absolute;
left: 130px;
top: 163px;
}
Thats the code for the block. It keeps the margin on the right as I resize
the window, but the right doesn't behave the same way
>
> To get the answer, please give a link to your website. It is hard to know
> what does your CSS file looks like.
DrewC wrote:
> I am trying to position a block in my CSS and I want it to when I resize the
> browser window the margin on both sides remain the same. But I can only get
> the left side to behave this way
When you (1) provide a URL as Animesh suggests, you can also (2) explain
what you mean by "remain the same": do you mean the same as each other,
or the same as they were before resizing? Also, you may wish to (3) post
your CSS topics to comp.infosystems.www.authoring.stylesheets.
--
John
Pondering the value of the UIP: http://blinkynet.net/comp/uip5.html
Scripsit DrewC:
> I am trying to position a block in my CSS and I want it to when I
> resize the browser window the margin on both sides remain the same.
> But I can only get the left side to behave this way
Set margin-left: auto and margin-right: auto. Make sure you have a
conforming doctype that puts browsers into "standards" mode, and a) accept
the fact that a fraction of old browsers don't center the block or b) use
HTML tools for centering.
Of course, you need to set a width for the block for this to work. If you
just want, say, 3em margins on both sides and the block to occupy the rest
of the available width, simply set margin-left: 3em and margin-right: 3em
(or just margin: 0 3em if it its OK to explicitly set vertical margins to
zero).
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
DrewC wrote:
> http://drewclayton.com/test.htm
>
> #top2 {
> padding: 10px;
> border: 5px solid #ccc;
> background: #666;
> height: 100px; /* ie5win fudge begins */
> voice-family: "\"}\"";
> voice-family:inherit;
> height: 46px;
> width: 352px;
> margin-top: 20px;
> margin-right: 20px;
> margin-bottom: 0px;
> margin-left: 20px;
> position: absolute;
> left: 130px;
> top: 163px;
> }
>
>
> Thats the code for the block. It keeps the margin on the right as I resize
> the window, but the right doesn't behave the same way
>
>> To get the answer, please give a link to your website. It is hard to know
>> what does your CSS file looks like.
>
>
Please bottom post to keep the context.
Your html file is almost empty so it is unclear what you desire to
achieve. Also, link to your CSS file using relative directory structure.
file:///c\........ will work only on your computer, not on the server.
Best,
Animesh
> Your html file is almost empty so it is unclear what you desire to
> achieve. Also, link to your CSS file using relative directory structure.
> file:///c\........ will work only on your computer, not on the server.
yes, I know that. I just want to know how to achive it before I upload it
In article
"DrewC"
> > Your html file is almost empty so it is unclear what you desire to
> > achieve. Also, link to your CSS file using relative directory structure.
> > file:///c\........ will work only on your computer, not on the server.
>
>
> yes, I know that. I just want to know how to achive it before I upload it
You want the egg to come first?
--
dorayme
DrewC wrote:
>> Your html file is almost empty so it is unclear what you desire to
>> achieve. Also, link to your CSS file using relative directory structure.
>> file:///c\........ will work only on your computer, not on the server.
>
>
> yes, I know that. I just want to know how to achive it before I upload it
>
>
>
Yes but your html file has only one div. You mentioned that you want to
position two columns. Can you post the full thing (however awful it is,
don't worry)?
Well bust mah britches and call me cheeky, on Tue, 14 Aug 2007 19:32:18
GMT DrewC scribed:
> I am trying to position a block in my CSS and I want it to when I
> resize the browser window the margin on both sides remain the same.
> But I can only get the left side to behave this way
Here are some excerpts from your posts to date:
(1) I am trying to position a block in my CSS and I want it to when I
resize the browser window the margin on both sides remain the same. But I
can only get the left side to behave this way
- Meaning you can only get the left side to remain the same as ...? What?
(2) Thats the code for the block. It keeps the margin on the right as I
resize the window, but the right doesn't behave the same way
- How many right hands do _you_ possess?
(3) yes, I know that. I just want to know how to achive it before I upload
it
- If the solution to your problem necessitates uploading it first, your
"want" is irrational.
Anyway, Jukka seems to have the answer. To keep consistently-sized side
margins, you can't include a container width. When I first read your post,
I had the same question as John Hosking asked. Whether English is your
native language or not, you should try to present your queries in better
fashion in the future.
--
Neredbojias
Half lies are worth twice as much as whole lies.