yuzu yuzu - 2 years ago 93
HTML Question

Using Html or javascript, how to set the height and width of a button to the ones of the parent div

I have the following html. And I know that the parent div with the

has been set its height and width in the css file. For this context, how can you set the height and width of the button to the same height and width of the parent div? In detail, I don't want to check the values in the css file for some reason.

<div id="id1">
<button type="button" >Hello<button/>

As a post script:
Let me explain some additional context. I cannot change the css because it is not mine. So I can't change that the parent div is defined its height and width by its id.
Please help me to solve the problem.

Answer Source

use: width: 100%; height: 100%;
or width: inherit; height: inherit; on child.

view solution: https://jsfiddle.net/warkentien2/zryd01r6/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download