Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Css Max And Min Sizes
moldboy
post Oct 23 2005, 05:07 AM
Post #1


Privileged Member
*********

Group: Members
Posts: 518
Joined: 29-April 05
From: Canada Eh?!?
Member No.: 6,408



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.
Go to the top of the page
 
+Quote Post
rvalkass
post Oct 23 2005, 08:34 AM
Post #2


apt-get moo
Group Icon

Group: [MODERATOR]
Posts: 2,116
Joined: 28-May 05
From: Hertfordshire, England
Member No.: 7,593
Spam Patrol



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.
Go to the top of the page
 
+Quote Post
jlhaslip
post Oct 23 2005, 09:04 PM
Post #3


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 4,005
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



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.
Go to the top of the page
 
+Quote Post
Tyssen
post Oct 23 2005, 10:15 PM
Post #4



***********

Group: Members
Posts: 1,161
Joined: 9-May 05
From: Brisbane, QLD
Member No.: 6,818



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/

Go to the top of the page
 
+Quote Post
reatum
post Oct 23 2005, 11:02 PM
Post #5


Member [Level 1]
****

Group: Members
Posts: 63
Joined: 3-October 05
Member No.: 12,515



Check out CSS play for min-height and min-width.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Weight Loss Through Food Portion Sizes And Nutritional Choices(4)
  2. A Question About The Creation Of A Magazine(6)
  3. Would Like A Sig And Banner (roman Warfare)(1)
  4. Are There Standard Sizes For Banners?(5)
  5. Changing Font Sizes On Wordpress(5)
  6. Text Sizes(7)
  7. Signature Pics Sizes(7)


 



- Lo-Fi Version Time is now: 8th September 2008 - 05:10 AM