EN
CSS - set element min width
0
points
In this article, we would like to show you how to set element min width using CSS.
Quick solution:
.element {
min-width: 100px;
}
Practical example
In this example, we use min-width CSS property to set element minimum width to 200px. If the width property percentage value will be less than 200px, the min-width property will prevent the element from shrinking horizontally.
// ONLINE-RUNNER:browser;
<!doctype html>
<html>
<head>
<style>
div.element {
width: 1%;
min-width: 200px;
background: orange;
}
</style>
</head>
<body>
<div class="element">Example text inside ...</div>
</body>
</html>