css max-width

rainbow baker

 

CSS-MAX-WIDTH

  • The max-width property defines the maximum width of an element. If the content is larger than the maximum width, it will automatically change the height of the element. 
  • If the content is smaller than the maximum width property has no effect.

CSS-MAX-WIDTH PROPERTY

  • The max-width property in css is used to define the maximum width of an element. 
  • The value of the width cannot be larger than the value by max-width then it will go to the next line and if the content is smaller than the max-width then it has no effort.

SYNTAX:
                max-width: none | length | percentage(%) | initial | inherit;

  Example: 

    <!DOCTYPE html>
    <html>
    <head>
    <tittle>max-width property</tittle>
    <! -- max-width css property-->
    <style>
          p {
                  max-width: 20%;
                  color: white;
                  background - color : white;
              }
    </style>
    </head>
    </body>
            <p>
                 hello
            </p>
    </body>
    </html>
    OUTPUT:

                hello

     
Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send