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:
xxxxxxxxxx
1
.element {
2
min-width: 100px;
3
}
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.
xxxxxxxxxx
1
2
<html>
3
<head>
4
<style>
5
6
div.element {
7
width: 1%;
8
min-width: 200px;
9
background: orange;
10
}
11
12
</style>
13
</head>
14
<body>
15
<div class="element">Example text inside ...</div>
16
</body>
17
</html>