Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

how to make responsive a div holding 2 divs in the right and left with image depending on screen size

how to make responsive a div holding 2 divs in the right and left with image depending on screen size

Problem

supposing I have a div that holds 2 divs,

Is there a way to make it responsive depending on screen size? I want to apply this to a mobile version but I am getting all messed up...



If you told me this was a computer generated image of a mothership hovering over a planet's surface, I would have believed you. Instead, I had to look up desmids, which turned out to be a form of green algae. I would have guessed this is a cell in the process of dividing, but it turns out that one of the characteristic features of desmids is that they're a single cell divided into two compartments. (See, even I'm learning something from this.) Desmids are so tiny that this image was taken at 100x power. The green backdrop? It's a moss.

The image and div I do not know how to reduce it depending on screen size...

please teake a look at a jsfiddle In fact I cannot make the div to hold 2 columns the image is under and not at the same level of left column...

Problem courtesy of: cMinor

Solution

For this you have percentage padding and Margin also, just apply some maths...

LeftDiv(padding:1% + margin:1% + width:44%) + RightDiv(padding:1% + margin:1% + width:44%) = 100%

Padding and margin is for top,bottom,left, right 1%,1%,1%,1%...

CSS:-

#left, #right {
    margin: 1%;
    padding: 2%;
    width: 43%;
}

If you want the image to be responsive too make its width:100%;

http://jsfiddle.net/FgnpL/5/

Solution courtesy of: SaurabhLP

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

how to make responsive a div holding 2 divs in the right and left with image depending on screen size

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×