简体   繁体   English

如何使右边的文本在滑块下

[英]How can I make the text on the right go under the slider

I have the slider and the text in a flex-direction: row container and I need the extra text to go under the slider. 我有一个滑块和一个处于flex-direction的文本:行容器,我需要多余的文本才能进入滑块。

I have tried giving them both display: inline-block and it still didn't work 我试图给他们两个显示:内联块,它仍然没有用

 .prod__page__cont { display: flex; flex-direction: row; flex-wrap: wrap; margin-top: 50px; } .slider { display: block; } .description { display: block; } .slider img { max-width: 100%; } 
 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <div class="container prod__page__cont"> <div class="slider col-6"> <img src="https://ibizabestservices.com/wp-content/uploads/2019/03/img232.jpeg"> </div> <div class="description col-6"> Located just a few kilometres from the centre of Ibiza, the prestigious five-bedroom villa sits high on the hillside of the exclusive Roca Llisa residential area. Designed by notorious architect Jordi Carreño, the villa is an enclave of luxury and peace that blends with the surrounding countryside and breath-taking scenery of the Mediterranean Sea. The villa's interiors created by Paul Davies London are the archetype of open architecture; with sophisticated blend of classic and contemporary lines styled with artwork of exquisite taste by the celebrated French photographer Bettina Rheims and the French Irish artists Nick & Chloe. The villa stylish designed furniture matches with harmony the surrounded environment. </div> </div> 

and the other 2 elements have display block 其他2个元素具有显示块

In this particular instance, flex and/or bootstrap columns are not appropriate. 在这种特定情况下,flex和/或bootstrap列不合适。 Floats are the way to go (that hurt me to say). 浮动是要走的路(这让我难以接受)。

 .prod__page__cont { margin-top: 50px; } .slider { width: 300px; height: 300px; background-color: #CCC; float: left; margin-right: 1rem; } 
 <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <div class="container prod__page__cont"> <div class="slider"></div> <p class="description"> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM