html - full-screen fit images in two columns -
i'm beginner , tried make 1 page myself, however, result not good. try explain need: full-screen page 2 images, 1 image cover 50% of horizontal space of browser window, , second image on right side covering rest of page. need both images responsive , keep 100% height. when window resized, left , right sides of both images cropped. similar this: http://www.gt3themes.com/website-templates/soho/striped_landing.html
is difficult make? tried follow guides on web, result images stretched , not cropped. maybe wrong , need create 2 columns , put images inside? appreciate help.
my current code is:
.photo{ size: 100%; position: relative; overflow: hidden; } .photo img{ max-width: 50%; height: 100%; }
the site linked more or less did this:
html
<div id="container"> <div id="left" class="halfwidthcontainer"> <div id="left-image" class="image"></div> </div> <div id="right" class="halfwidthcontainer"> <div id="right-image" class="image"></div> </div> </div>
css
html, body, #container, #left, #right, #left-image, #right-image { height:100%; } .halfwidthcontainer { float: left; width: 50%; } .image { background-size: container; background-repeat: no-repeat; background-position: 50% 50%; } #left-image { background-color: red; background-image: url(''); } #right-image { background-color: blue; background-image: url(''); }
the general idea 2 containers sit side side, float
ed (see this answer why use float
s position containers side side instead of inline-block
).
the idea thereafter explot css background
property allow overflow/positioning effects want. can read more here.
you're going want fill in background-image
properties of #left-image
, #right-image
ids add images want.
Comments
Post a Comment