63.2k views
4 votes
What would be the total width of the div in the code below?

>

a) 300px
b) 404px
c) 323px
d) 346px

1 Answer

3 votes

Answer:

The answer to this question is given below in the explanation section.

Step-by-step explanation:

The correct answer to this question is d- 346px.

The complete code of this example is given below:

<div>

>

</div>

while the image width is 300px.

It is noted that the image width is 300px and the margin is 20 px.

Margin:20px means that image margin from four side is 20 px each.

So the width of dive from both side increase to 40 px and the image has 300 px, then total width becomes 340px. Now the border also has 3px of four sides of the image, then the width of the border becomes 6px.

so the total width of the div tag is 346 px.

In short, we can calculate the width of tag as below:

total width of div= width of image+ width of margin+ width of border

total width of dive= 300px+40px+6px

total width of div=346px.

User Bastian
by
8.3k points

Related questions

asked Sep 10, 2021 217k views
JArgente asked Sep 10, 2021
by JArgente
8.2k points
1 answer
1 vote
217k views
asked Sep 17, 2021 40.2k views
Dontay asked Sep 17, 2021
by Dontay
8.5k points
1 answer
1 vote
40.2k views