繁体   English   中英

停止文字环绕图像

[英]Stop text wrapping around image

我有一个正在处理的个人小型项目,当从台式机尺寸变为移动尺寸时,似乎无法弄清楚如何使文本停止环绕图像

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

这是它现在正在做的事情:

图片1

图片2

图片3

我希望文本缩小到一定宽度时移到底部

->请添加以下HTML和CSS代码

->在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> 

您必须为移动屏幕尺寸(<768像素)编写css,为图像的宽度样式设置值100%。 示例,根据上面的代码:

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

暂无
暂无

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

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