Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="container">
- <div id="first_child" style="width:350px; height:350px;"> </div>
- <div id="second_child" style="width:???px; height:350px;"> </div>
- </div>
- #container {
- width:89%;
- height:350px;
- }
- #first_child {
- float:left;
- width:350px;
- height:350px;
- }
- #second_child {
- height:350px;
- margin-left:350px;
- }
- #second_child {
- width: -moz-calc(100% - 350px);
- width: -webkit-calc(100% - 350px);
- width: calc(100% - 350px);
- }
- var containerWidth = $('#container').width();
- $('#second_child').width(containerWidth - 350);
- // This is assuming there is no padding.
- totalWidth = document.getElementById('container').offsetWidth;
- firstChildWidth = document.getElementById('first_child').offsetWidth;
- document.getElementById('second_child').style.width = (totalWidth - firstChildWidth) + 'px';
- #container {
- position:relative
- }
- #first_child {
- width:350px;
- height:350px
- }
- #second_child {
- height:350px;
- position:absolute;
- top: 0;
- left:350px;
- right:0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement