HTML CSS examples for CSS Layout:Responsive Layout
text image resize on responsive 2 column layout
<html> <head> <title>Lorem ipsum dolor sit am</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .span_2_of_2 {<!-- w w w .j a va 2 s. co m--> width:100%; } .span_1_of_2 { width:50.3%; text-align:center; } .span_1_of_2 p { max-width:301px; margin:0 auto; } .section { clear:both; padding:0px; margin:0px; } .section { display:flex; } .group:before, .group:after { content:""; display:table; } .group:after { clear:both; } .group { zoom:2; } .col { position:relative; margin:2% 0 2% 2.7%; padding-bottom:41px; } .col:first-child { margin-left:0; } . @media only screen and (max-width: 480px) { .col { margin: 1% 0 1% 0%; } } .button { bottom:0; left:0; margin:auto; position:absolute; right:0; } .imghome { max-width:100%; height:auto; } @media only screen and (max-width: 480px) { .span_2_of_2 { width:100%; } .span_1_of_2 { width:100%; } .span_1_of_2 p { max-width:51%; height:auto; } } </style> </head> <body> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi u</p> <div class="section group"> <div class="col span_1_of_2"> <h1>Lorem ipsum</h1> <img class="imghome" width="300" height="200" src="https://www.java2s.com/style/demo/Firefox.png"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendre</p> <button class="button button5">Lorem </button> </div> <div class="col span_1_of_2"> <h1>Lorem ipsum</h1> <img class="imghome" width="300" height="200" src="https://www.java2s.com/style/demo/Safari.png"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed </p> <button class="button button5">Lorem </button> </div> </div> </body> </html>