1.4. *** width, height *** - kích thước element

 


Demo : https://www.lenlop123.com/2020/09/14-width-height.html



<style>
div.d1 {
    border: 2px solid red;    
    width: 100px;
    height: 80px;
}
div.d2 {
    border: 5px solid green;    
    width: 100%;
    height: 90px;
}
p.first {
    border: 5px solid green;    
    min-height: 100px;
}
p.second {
    border: 5px solid green;    
    max-width: 100px;
}
</style>

<div class="d1">This is a box with 100px width and 80px height.</div>
<div class="d2">width is <strong>100%</strong> and height is <strong>100px</strong></div>
<p class="first"> <strong>minimum height </strong> of this paragraph is set to 100px.</p>
<p class="second"><strong> maximum width </strong> of this paragraph is set to 100px.</p>






Nhận xét