Why are the resulting (after running the html/css code) box sizes of the div and label different when applying the same set of properties?
P粉788571316
P粉788571316 2023-09-12 18:39:31
0
1
360

div, a {
    height: 100px;
    width: 200px;
    border: 5px solid black;
    margin: 15px;
}
<div>This is a div tag</div>
<a href="https://www.google.co.in" target="_blank">Google</a>

I was expecting the same size box but found a different one.

P粉788571316
P粉788571316

reply all(1)
P粉066224086

Just add display: block; to your CSS.

like this:

div, a {
    display: block;
    height: 100px;
    width: 200px;
    border: 5px solid black;
    margin: 15px;
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!