
The CSS min-width property specifies the minimum width of an element.
The CSS min-width property prevents the value of the width property from becoming smaller than the min-width.
Syntax:
min-width: length;
length – specifies the width in px, %, etc (read also Units in CSS).
Example:
<!DOCTYPE html>
<html>
<head>
<style>
.example1, .example2 {
background-color: #fed9b7;
display: inline-block;
}
.example2 {
min-width: 400px;
}
</style>
</head>
<body>
<h4>*no min-width specified</h4>
<span class="example1">This is a paragraph.</span>
<h4>min-width: 400px;</h4>
<span class="example2">This is a paragraph.</span>
</body>
</html>
Output:
*no min-width specified
This is a paragraph.min-width: 400px;
This is a paragraph.Enjoy coding!
Read also: