[英]Create a background behind image with full width?
I have a small challenge.我有一个小挑战。 I have a wordpress theme with fixed width for text.
我有一个 wordpress 主题,文本宽度固定。 i would like to add images but add a background to each image which is full width.
我想添加图像,但要为每个全宽图像添加背景。 Is that possible?
那可能吗?
I had the idea to make a wrapper.我有做包装纸的想法。 position it absolute left 0 and make the image center.
position 它绝对左 0 并使图像居中。
Or is there a way to make some classes ignore a rule or how i could make an exception?或者有没有办法让一些类忽略规则或者我如何可以例外?
I don't know much about WordPress themes but if it's CSS just do:我不太了解 WordPress 主题,但如果它是 CSS 就这样做:
body: {
background-image: url("your url or file path here")
}
try this code may fix your issue试试这个代码可能会解决你的问题
.yourselecter {
background-image: url("your image url");
background-size: 100% 100%;
}
if the image is stretch use this property如果图像是拉伸的,请使用此属性
.yourselecter {
background-size: cover;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.