CSS - min-width Property


CSS - min-width Property

  • The minimum width property is used to assign the minimum width of an element.
  • The estimation of the min- width property can be a number, a length, or a rate. 

Example: 

p
{  
min-width: 600px;
height: 200px;
border: 3px solid #73AD21;
}

Sample Code:

<!DOCTYPE html>
<html>
    <body>
        <p
style="min-width:100px; border:1px solid green">
            Welcome to Wikitechy.Best E-Learning Website in the world.             Wikitechy want to reshape e-learning platform.
        </p>
    </body>
</html>

Code Explanation:

 

    For a paragraph element p we have specified its minimum width to be 100pixels using min-width property.

    Border property for a <p> tag creates a border around it. Border values 1px solid green defines the border strength, style and color respectively.

Output:


    Here the paragraph text “Welcome to Wikitechy. Best E-Learning Website in the world. Wikitechy want to reshape e-learning platform.” has a minimum width of 100 pixels where the text cannot be typed beyond 100 pixels.