Setting Minimum and Maximum Sizes

Description

You can use the min- and max- properties to set limits to size the element.

Example

The following code sets min and max Ranges for Size.


<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
img {<!--from  w  ww.j a v a2  s .c o  m-->
  background: lightgray;
  border: 4px solid black;
  margin: 2px;
  box-sizing: border-box;
  min-width: 100px;
  width: 50%;
  max-width: 200px;
}
</style>
</head>
<body>
  <img src="http://www.java2s.com/style/download.png" alt="small  banana">

</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table