Css:- Max width and width

<!DOCTYPE html>
<html>

<head>
 <meta name="viewport" content="width=device-width, initial-scale=1">

 <style>
  .mxwth_cls {
   max-width: 500px;
  }
 
  .wth_cls {
   width: 500px;
  }
 </style>

</head>

<body>
 <div class="mxwth_cls">
  This div has max-width 500px
 </div>
 <div class="wth_cls">
  This div has width 500px
 </div>
</body>

</html>



Description:-   
max-width
  • The max-width property is used to create the maximum width of an element.
  • This prevents the value of the width property from becoming larger than max-width.
  • This is important when we make a site it's good on all devices (desktops, tablets, and phones).
  • The width of a block-level element will prevent it from stretching out to the edges of its container.
width
The width property is used to set the exact width of an element.

Css:- Max width and width Css:- Max width and width Reviewed by Network security on May 08, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.