CSS question

CSS question

am 14.08.2007 21:32:18 von DFS

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

Re: CSS question

am 14.08.2007 21:46:37 von Animesh Kumar

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.

Re: CSS question

am 14.08.2007 21:52:28 von DFS

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.

Re: CSS question

am 14.08.2007 21:57:55 von John Hosking

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

Re: CSS question

am 14.08.2007 22:00:29 von jkorpela

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/

Re: CSS question

am 14.08.2007 22:25:52 von Animesh Kumar

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

Re: CSS question

am 14.08.2007 22:27:14 von DFS

> 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

Re: CSS question

am 15.08.2007 00:09:39 von dorayme

In article ,
"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

You want the egg to come first?

--
dorayme

Re: CSS question

am 15.08.2007 00:10:19 von Animesh Kumar

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)?

Re: CSS question

am 15.08.2007 01:23:50 von Neredbojias

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.