Css Max And Min Sizes

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > CSS (Cascading Style Sheets)

Css Max And Min Sizes

moldboy
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.

Reply

rvalkass
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:

HTML
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.

Reply

jlhaslip
http://www.w3schools.com/css/pr_dim_max-width.asp

http://www.w3schools.com/css/pr_dim_min-width.asp

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:

CODE
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.

 

 

 


Reply

Tyssen
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.:

CODE
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://www.svendtofte.com/code/max_width_in_ie/


Reply

reatum
Check out CSS play for min-height and min-width.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : css max min sizes


    Looking for css, max, min, sizes

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for css, max, min, sizes

*MORE FROM TRAP17.COM*
advertisement



Css Max And Min Sizes



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE