Issue
What's the difference between width:100%
and min-width:100%
for body
?
body{
width:100%
}
and
body{
min-width:100%
}
Solution
If you set the width
parameter for body, the page size will always be the size of your screen. At the same time if you set min-width
parameter for body it will be the same size as your screen but it can increase. This is hard to see, but if we were to change the screen size the difference would be visible.
without min-width
.a {
border: 5px solid red;
width: 5%;
height: 100%;
padding: 1rem;
color: blue;
}
<!DOCTYPE html>
<html>
<body style="margin: 0; font-family: verdana;">
<div class="a">
1234567890
</div>
</body>
</html>
with min-width
.a {
border: 5px solid red;
min-width: 5%;
height: 100%;
padding: 1rem;
color: blue;
}
<!DOCTYPE html>
<html>
<body style="margin: 0; font-family: verdana;">
<div class="a">
1234567890
</div>
</body>
</html>
Answered By - TheTS
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.