jhe*_*eul 9 css css3 twitter-bootstrap-3
我遇到了一个问题,即在我的列上将图像包裹在我的图像周围.我有一个模板,它正在运行多个页面.一些图像不够长,所以它不能超过整个列......我意识到它们在2个不同的div中,但如果有人有解决方案请告诉我.
如果您阅读并查看问题所在,您会发现它不重复......
这是我的代码的样子
<div class="row" data-sf-element="Row">
<div id="contentPlaceholder_C002_Col00" class="sf_colsIn col-md-6" data-sf-element="Column 1">
<div>
<div>
<h2>Contrary to popular belief, Lorem Ipsum is not simply r</h2>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during th</p>
<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during th</p>
</div>
</div>
</div>
<div id="contentPlaceholder_C002_Col01" class="col-md-6" data-sf-element="Column 2"> <img src="/images/default-source/careers/careers_1.jpg?sfvrsn=2" title="careers_1" alt="careers_1"> </div>
</div>
Run Code Online (Sandbox Code Playgroud)
小智 12
使用2列时,文本永远不会缠绕在图像上.
您应该将图像和文本放在一列中并将其全部用完.然后将文本和图像包装在div中并将它们浮动到左侧.在这方面的一些事情(代码是一个例子,没有测试):
<div class="col-md-12">
<div class="pull-left"><img src="YourImage.png"/></div>
<div class="pull-left">Your text goes here......</div>
</div>
Run Code Online (Sandbox Code Playgroud)
您可能需要在图像上留出一些余量,以使文本不会贴近图像
小智 8
这适合我.
<div class="col-md-12">
<img src="img/image.jpg" class="pull-left">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste molestiae aliquam optio mollitia, unde quas eaque voluptatem dignissimos eos maiores magni reprehenderit nisi, corrupti nemo hic id cum quasi officiis!</p>
</div>
Run Code Online (Sandbox Code Playgroud)
这些都不适合我。我使用 Rails 5.2 和 Bootstrap 4.1 的工作代码:
<div class="row">
<div class="col">
<img src="<%=url_for(@user.image)%>" class="float-left" style="height:150px;margin-right:10px">
<p>A bunch of text</p>
<p>More text</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)