[英]Make a header and picture with text responsive?
When I adjust my browser to the size of a cell phone to check everything, the sentences on the image overlap.当我将浏览器调整为手机大小以查看所有内容时,图像上的句子重叠。 In addition, the elements in the header also shift.
此外,header 中的元素也会发生偏移。 How can I prevent this?
我怎样才能防止这种情况?
https://i.stack.imgur.com/kMIPP.jpg https://i.stack.imgur.com/kMIPP.jpg
The CSS line-height property is responsible for this text effect. CSS line-height 属性负责此文本效果。 You can find more here CSS line-height
你可以在这里找到更多CSS line-height
If you want to be in control of what resolution your browser uses in a given style, check out this tutorial on CSS media-query如果您想控制浏览器在给定样式中使用的分辨率,请查看CSS 媒体查询上的本教程
Add a breakpoint
for phone resolution using media-query
使用
media-query
为电话解析添加breakpoint
Add a property line-height
to your header将属性
line-height
添加到您的 header
Reload the page in the browser and reduce the window size.在浏览器中重新加载页面并减小 window 大小。 Now the text should be displayed without overlapping.
现在应该显示文本而不重叠。
@media only screen and (max-width: 768px) { /* For mobile phones: */.header-class-name { width: 100%; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.