html - How to make a new line when content is too long? -
img { width:20%; } .shopinfol2 { display:inline-block; vertical-align:top; } h4 { color:red; }
<h4>div 1</h4> <div> <img src="https://s.yimg.com/xd/api/res/1.2/2a8.gbmwtalpfoqzfy.leg--/yxbwawq9exr3yxvjdglvbnnlcnzpy2u7ad00mda7ct04nttyb3rhdgu9yxv0bzt3ptqwma--/http://nevec-img.zenfs.com/prod/tw_ec05-7/71eb3ae4-2784-4a9c-a3fa-6985fd12a43f.jpg" alt="" class="imgqrl2"> <div class="shopinfol2"> <h5>title here</h5> <p>address address </p> </div> </div> <h4>div 2</h4> <div> <img src="https://s.yimg.com/xd/api/res/1.2/2a8.gbmwtalpfoqzfy.leg--/yxbwawq9exr3yxvjdglvbnnlcnzpy2u7ad00mda7ct04nttyb3rhdgu9yxv0bzt3ptqwma--/http://nevec-img.zenfs.com/prod/tw_ec05-7/71eb3ae4-2784-4a9c-a3fa-6985fd12a43f.jpg" alt="" class="imgqrl2"> <div class="shopinfol2"> <h5>title here</h5> <p>address address address address address address address address address address address address address address </p> </div> </div>
here 2 divs , difference content length of p tag.
as can see result, p length in div2 long , div2 move down div1.
what can keep div2 next div1 , p tag switch newline when content long?
set width you're div .shopinfol2
Comments
Post a Comment