简体   繁体   English

停止文字环绕图像

[英]Stop text wrapping around image

I have a small personal project that I am working on and I can't seem to figure out how to make the text stop wrapping around the image when going from desktop size to mobile responsively 我有一个正在处理的个人小型项目,当从台式机尺寸变为移动尺寸时,似乎无法弄清楚如何使文本停止环绕图像

 <div class="text">​​​​​​​​ <img src="/square.png" align="left" class="ms" alt=""/> </div> <div> <span class="ms">Two paragraphs of text</span> </div> 

Here is what it's doing now: 这是它现在正在做的事情:

Picture 1 图片1

Picture 2 图片2

Picture 3 图片3

I'd like for the text to shift to the bottom when it's shrunk to a certain width 我希望文本缩小到一定宽度时移到底部

-> Please add following HTML & css code ->请添加以下HTML和CSS代码

-> Set image path in img tag ->在img标签中设置图像路径

 @media (max-width: 767px) { .image, .text { clear: both; } } 
 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1" /> <title> stop text wrapping around image </title> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div class="image"> <img src="file-path/test.jpg" align="left" class="ms" alt="image"/> </div> <div class="text"> <span class="ms">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span> </div> </body> </html> 

You must write css for mobile screen size (< 768 px), set value 100% for width style of image. 您必须为移动屏幕尺寸(<768像素)编写css,为图像的宽度样式设置值100%。 Example, according to your code above: 示例,根据上面的代码:

@media(max-width:768px){
    .text {
        width: 100%;
    }
}

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

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