Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <div id="container">
  2. <div id="first_child" style="width:350px; height:350px;">&nbsp;</div>
  3. <div id="second_child" style="width:???px; height:350px;">&nbsp;</div>
  4. </div>
  5.  
  6. #container {
  7. width:89%;
  8. height:350px;
  9. }
  10. #first_child {
  11. float:left;
  12. width:350px;
  13. height:350px;
  14. }
  15. #second_child {
  16. height:350px;
  17. margin-left:350px;
  18. }
  19.  
  20. #second_child {
  21. width: -moz-calc(100% - 350px);
  22. width: -webkit-calc(100% - 350px);
  23. width: calc(100% - 350px);
  24. }
  25.  
  26. var containerWidth = $('#container').width();
  27. $('#second_child').width(containerWidth - 350);
  28.  
  29. // This is assuming there is no padding.
  30. totalWidth = document.getElementById('container').offsetWidth;
  31. firstChildWidth = document.getElementById('first_child').offsetWidth;
  32. document.getElementById('second_child').style.width = (totalWidth - firstChildWidth) + 'px';
  33.  
  34. #container {
  35. position:relative
  36. }
  37.  
  38. #first_child {
  39. width:350px;
  40. height:350px
  41. }
  42.  
  43. #second_child {
  44. height:350px;
  45. position:absolute;
  46. top: 0;
  47. left:350px;
  48. right:0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement