html - Make the text as wide as the sibling image -


thats codepen: http://codepen.io/helloworld/pen/bemola?editors=1100

i want text below image not go further right border of image. instead text should line-break.

how can that?

<div style="background:orange;"> <img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:and9gcrmvfchgvt3ywcj6yaxrkgnru6vrazaibtfsap_mazinj5gqmu1cq" />text below should stop @ image right border , line-break    <h2>sie haben ihre anfrage erfolgreich storniert!</h2> <p>     lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. @ vero eos et accusam et justo duo dolores et ea rebum. stet clita kasd gubergren, no sea takimata sanctus est lorem ipsum dolor sit amet. lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. @ vero eos et accusam et justo duo dolores et ea rebum. stet clita kasd gubergren, no sea takimata sanctus est lorem ipsum dolor sit amet. </p>  </div> 

i not want hardcode width of image anywhere in code.

you need wrap image , text div this:

<div class="wrapper">    <img src="#"/>    <p>lorem ipsum dolor sit ammet</p> </div> 

then give wrapper same width image, close this:

 .wrapper {   width: 350px } 

thats 1 way, can use grid framework bootstrap job


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -