html - Parent div copy dimensions of child image -
i need set parent div in way, it's child image inside of it, since parent div has visible border, have wrap around image , text. thank tips :)
html:
.about-us { border: 1.5px solid $grey; width: 100%; height: 275px; //i need rid of it's fixed .us-image { float: left; width: 30%; img { width: 100%; height: auto; padding: .7%; } } .about-us-text { float: left; width: 64%; margin: 0 3%; h3 { margin-top: 5%!important; text-transform: uppercase; font-size: 130%; font-weight: 500; } } }
<section class="about-us"> <div class="us-image"> <img src="img/about-us.png" alt="about-us"> </div> <div class="about-us-text"> <h3>abc</h3> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. donec pharetra mauris ornare ultricies malesuada. donec pretium, dolor dapibus tempor, nisl enim lacinia risus, eget ullamcorper diam velit id tortor. nulla velit purus, euismod suscipit sed, gravida et ligula. quisque scelerisque sodales faucibus. vestibulum ullamcorper eget dui id laoreet. nullam pellentesque neque sagittis, ullamcorper sem sed, vehicula ex. nullam lobortis et nibh eget cursus. aenean vitae blandit lacus. </p> </div> </section> <!-- /about-us-->
remove height .about-us
div , clear floats using clear:both
.about-us::after
html:
<section class="about-us"> <div class="us-image"> <img src="https://s-media-cache-ak0.pinimg.com/236x/af/99/5d/af995d61b255bfd53bbdbfa343451949.jpg" alt="about-us"> </div> <div class="about-us-text"> <h3>abc</h3> <p>lorem ipsum dolor sit ame, consectetur adipiscing elit. donec pharetra mauris ornare ultricies malesuada. donec pretium, dolor dapibus tempor, nisl enim lacinia risus, eget ullamcorper diam velit id tortor. nulla velit purus, euismod suscipit sed, gravida et ligula. quisque scelerisque sodales faucibus. vestibulum ullamcorper eget dui id laoreet. nullam pellentesque neque sagittis, ullamcorper sem sed, vehicula ex. nullam lobortis et nibh eget cursus. aenean vitae blanditd lacus. </p> </div> </section><!-- /about-us-->
css:
.about-us { border: 1.5px solid black; width: 100%; //i need rid of it's fixed .us-image { float: left; width: 30%; img { width: 100%; height: auto; padding: .7%; } } .about-us-text { float: left; width: 64%; margin: 0 3%; h3 { margin-top: 5%!important; text-transform: uppercase; font-size: 130%; font-weight: 500; } } } .about-us::after{ content: ""; display:table; clear:both; }
Comments
Post a Comment