I have two divs and they should be the same size. I tried to put a height it works in desktop size but when I use different platform it become a mess
____________
| ___________
| | | |
| | | |
| | | |
|_|_________ |
|___________|
.custombox {
text-align: center;
padding: 10px;
position: absolute;
border: 1px solid;
}
.customparentbox {
background: red
}
<div class="customparentbox">
<div class="custombox">
<p>Sample text</p>
<button>test</button>
</div>
</div>
I've made some changes in your css
From
.custombox{
text-align: center;
padding: 10px;
position: absolute;
border: 1px solid;}
.customparentbox{background:red}
To
.custombox {
text-align: center;
padding: 10px;
position: relative;
top:10px;
left:10px;
border: 1px solid;
}
.customparentbox {
width:100px;
background: red;
border:1px solid green;
}
Here is a jsfiddle I made.