How can I have width:50%
with panel-default
, but including padding
or margin
(not sure which one is more appropriate) in the calculation, so that the panel-default
perfectly fills 100% of the width?
Code
.testing-here {
padding: 2.5px;
display: inline;
box-sizing: border-box;
}
body {
box-sizing: border-box;
}
.panel-default {
box-sizing: border-box;
border-style: none;
position: relative;
width: 50%;
padding-bottom: 40%;
/* = width for a 1:1 aspect ratio */
overflow: hidden;
background-color: #446CB3;
border-radius: 0px;
display: inline-block;
}
.panel-body {
color: white;
position: absolute;
}
<div class="testing-here">
<div class="panel panel-default">
<div class="panel-body">
Basic panel example
</div>
</div>
</div>
UPDATE:
Right now if I set the width
to 50%
all the panels dropdown vertically because they can't fit side by side.