I need two divs side by side with the one on the right always stretched to 100%. The one on the left is not always going to be there and contains an image of 128px width & height. Inside the div on the right is a table that is 100% width. Can this be done? Does anyone know how to do this?
Share
Here is a jsfiddle that (I think) solves your problem. Next time some code would be helpful so we have a place to start.
The trick is to use absolute positioning in the
divon the right side to make it “stretch.” Note that the parent cannot have static positioning.EDIT: If the image is not always there, you might need some logic when using this technique. Remove/add a class in JavaScript or something to make
.child2haveleft: 0px;. Not sure what technologies you’re using.EDIT2: Here is a link to an article that discusses the technique, as well as other situations where it’s useful.