Jump to content
xisto Community
Sign in to follow this  
moldboy

Css Max And Min Sizes

Recommended Posts

Is it possable with CSS to say I want <<An item>> to be so wide, and no narrower, however if it should need to it can expand as much as I want? Or better yet, can expand only a certain amount?So a DIV would be 400px wide, by default however if 500px of text were inserted into it the DIV would expand it's boundries.

Share this post


Link to post
Share on other sites

As far as I am aware there is a very simple way to set a minimum width, but this doesn't work with IE and I can't find a work around to get it to work. If you're still interested then the code is:

 

div{min-width:400px;}

 

As I said, this wont work with Internet Explorer and can play havok with site layouts and designs, so use at your own risk.

Share this post


Link to post
Share on other sites

http://forums.xisto.com/no_longer_exists/

 

http://forums.xisto.com/no_longer_exists/

 

Here is a better link for the css dimensioning properties.

I'll ask the mods to delete the specific links for min-width and max-width since this new link is more informative and should be more helpful to yourself and others.

The specific information for min and max sizes are also available on the w3schools site. Use the site search box in the top right corner.

 

So, tweo things come out of this. The css for the element would become:

 

element {min-width: 50%; max-width: 80%}
and as reported by rvalkass below and on the chart at w3schools these properties are not supported by IE. Use it carefully.

 

Sorry, bad link above. Try this one css dimensioning properties

 

Notice from BuffaloHELP:
Merged and edited as reported.

Share this post


Link to post
Share on other sites

IE treats width & height as min-width and min-height. Using child selectors which IE doesn't understand, you can feed it and other browsers different rules, e.g.:

body { width: 700px;}html>body { width: auto; min-width: 700px;}
Max values are a bit trickier. Here's an article that explains on how to do it: http://forums.xisto.com/no_longer_exists/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.