Why doesn´t width and max-width work?

P

palun

Ok, here´s a really elementary question:

-- Why doesn't "width" and/or "max-width" in CSS have any effect on, for
instance <div> or <td>? (I'm using Firefox.)

/u
 
R

rf

palun said:
Ok, here´s a really elementary question:

-- Why doesn't "width" and/or "max-width" in CSS have any effect on, for
instance <div> or <td>? (I'm using Firefox.)

They do. URL to what you have tried?
 
P

palun

Sorry, it's not deployed. But the code is really simple:

In html:

<div id="anId">
Some stuff...
</div>

and in css:

#anId {
width=400px;
}

But the content ("Some stuff") still gets spread out over the whole page...


I just realized: Could any of the stuff inside the div affect its width?
I.e. can the content affect the width of the of container? (Not very
logical...)

/ulf

rf skrev:
 
M

Michael Fesser

..oO(palun)
Sorry, it's not deployed. But the code is really simple:

In html:

<div id="anId">
Some stuff...
</div>

and in css:

#anId {
width=400px; ^
}

But the content ("Some stuff") still gets spread out over the whole page...

It's always a good idea to validate the HTML and CSS before asking for
help:

#anId {
width: 400px;
}

Micha
 
P

palun

Terribly sorry. My mistake. (I wrote the code in the message. Should
have copied.)

Anyway, the code is correct in the CSS-file (and it still doesn't work).

/ulf

Michael Fesser skrev:
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Fri, 11 Jan 2008 10:22:23
GMT palun scribed:
Terribly sorry. My mistake. (I wrote the code in the message. Should
have copied.)

Anyway, the code is correct in the CSS-file (and it still doesn't
work).

No, it isn't correct or it would work. Trust me.
 
B

Ben C

Terribly sorry. My mistake. (I wrote the code in the message. Should
have copied.)

Anyway, the code is correct in the CSS-file (and it still doesn't work). [...]
It's always a good idea to validate the HTML and CSS before asking for
help:

#anId {
width: 400px;
}

I assure you width does work. There must be something else going on:
perhaps another more specific style sets width back to auto, perhaps you
mis-typed the selector, perhaps the contents overflow.

This is why you have to post a url.
 
P

palun

You are right. I should deploy it (though it looks terrible right now).
BTW: I did validate it and that seems ok apart from the
"wicket:id"-attributes on some of the tags (required by the wicket
framework -- great stuff if you know some java)
/u

Ben C skrev:
Terribly sorry. My mistake. (I wrote the code in the message. Should
have copied.)

Anyway, the code is correct in the CSS-file (and it still doesn't work). [...]
But the content ("Some stuff") still gets spread out over the whole page...
It's always a good idea to validate the HTML and CSS before asking for
help:

#anId {
width: 400px;
}

I assure you width does work. There must be something else going on:
perhaps another more specific style sets width back to auto, perhaps you
mis-typed the selector, perhaps the contents overflow.

This is why you have to post a url.
 
J

JJ

palun said:
You are right.

It's a shame you got any responses at all. You are inconsiderate. You
couldn't be bothered to create an online example of the problem, you
couldn't be bothered to post accurate code, and you couldn't be bothered
to be consistent with everybody else in the group and type your response
below the text you were referring to.
 
R

rf

palun said:
Terribly sorry. My mistake. (I wrote the code in the message. Should have
copied.)

Anyway, the code is correct in the CSS-file (and it still doesn't work).

I am here to tell you that it works for untold millions of other pages out
there. Why is yours different? I don't bloody know, you won't show it to me!

Again: URL? If you don't supply one then nobody here has a snowflakes chance
in hell of helping you.
 
C

Chaddy2222

I am here to tell you that it works for untold millions of other pages out
there. Why is yours different? I don't bloody know, you won't show it to me!

Again: URL? If you don't supply one then nobody here has a snowflakes chance
in hell of helping you.
Well it depends on what browser the Op is useing, IE6 does not support
min and max width. IE7 does though.
 
C

Chaddy2222

.oO(Chaddy2222)



He's on Firefox.

Micha
Well good for him then.
It's probably just a mark-up error but who knows the OP did not give
us an URL, how many timse do we need to say / write such advice before
people start actually makeing life easier for all of us by giving us a
URL to a problem.
That was a long rant from me.
 
D

dorayme

"rf said:
I am here to tell you that it works for untold millions of other pages out
there. Why is yours different? I don't bloody know, you won't show it to me!

Again: URL? If you don't supply one then nobody here has a snowflakes chance
in hell of helping you.

O I dunno? Did you see how Boji said trust him and the OP just
fell over in gratitude like it was the biggest revelation since
sliced white bread was announced to the general public?
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Fri, 11 Jan 2008 20:19:52
GMT dorayme scribed:
O I dunno? Did you see how Boji said trust him and the OP just
fell over in gratitude like it was the biggest revelation since
sliced white bread was announced to the general public?

You may enjoy the music vid at

http://www.neredbojias.com/

The broad reminds me of you. (PS: It's Flash and seems to be a bit sticky
at peak times and you may need hi-speed.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top