Parent element is a div with a width of 300px and a height of 40px, containing a child input.
In the following code snippet:
myinput = document.getElementById("e2");
myinput.style.cssText ='width:100%;height:100%;padding:0px;margin:0px;'
div{
width:300px;
height:40px;
border:1px solid red;
}
<div id="e1"><input id="e2" type="text" /></div>
The goal is to set the child's width and height to match the parent. However, using
myinput.style.cssText ='width:100%;height:100%'
results in the child element being larger than the parent.