简体   繁体   English

背景颜色在屏幕的全宽

[英]background-color to be in full width of the screen

I need this text to be center and the background color width to be in full screen I didn't find an answer for it here我需要这个文本居中,背景颜色宽度全屏我在这里没有找到答案

 .carousel-content { text-align: center; bottom: 0px; opacity: 0.8; display: inline-block; border: none; text-transform: uppercase; position: absolute }.carousel-content span{ text-shadow: 0 1px 2px rgba(0,0,0,.6); color: #fff; background-color: #c52d2f; background-size: cover;important: width; 100%: padding; 10px: text-shadow; 1px 0px 1px #000: } #span1{ font-style; italic: font-size; 35px: white-space; nowrap; }
 <div class="main carousel-inner"> <div class="item active"> <%= image_tag "limo1.jpeg"%> <div class="carousel-content"> <p><span id="span1" class="animated bounceInLeft delay-1s"> NEED A LIMOUSINE? Call OR Text: <a href="tel:+1-604-374-7474">(604) 374 7474</a> </span></p> </div>

The <%= image_tag "limo1.jpeg" %> part is from Ruby on Rails, but unrelated to the issue. <%= image_tag "limo1.jpeg" %>部分来自 Rails 上的 Ruby,但与问题无关。

Does this work?这行得通吗?

 .carousel-content { text-align: center; bottom: 0px; opacity: 0.8; display: block; border: none; text-transform: uppercase; position: absolute; left: 0; /* Added */ right: 0; /* Added */ background-color: #c52d2f; /* Added */ }.carousel-content span { text-shadow: 0 1px 2px rgba(0,0,0,.6); color: #fff; width: 100%; padding: 10px; text-shadow: 1px 0px 1px #000; /* Background-color and background-size removed */ } #span1 { font-style: italic; font-size: 35px; white-space: nowrap; }
 <div class="main carousel-inner"> <div class="item active"> <%= image_tag "limo1.jpeg"%> <div class="carousel-content"> <p> <span id="span1" class="animated bounceInLeft delay-1s"> NEED A LIMOUSINE? Call OR Text: <a href="tel:+1-604-374-7474">(604) 374 7474</a></span> </p> </div> </div> </div>

In Codepen it seems to work, but I saw that you are writing it inside a carousel and its code is not included, so I can't see if the changes will work in that context.在 Codepen 中它似乎可以工作,但我看到你在轮播中编写它并且它的代码不包括在内,所以我看不出这些更改是否会在那个上下文中工作。

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

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