简体   繁体   English

如何设置自举轮播字幕的样式?

[英]how to style bootstrap carousel-caption?

How do you style a bootstrap carousel-caption like a gradient background with opacity control?? 如何设置带有不透明度控制的渐变背景的自举轮播字幕?

the browser render looks this way 浏览器渲染看起来是这样的

我的浏览器渲染看起来是这样!

okay this is the carousel I'm working on. 好的,这是我正在处理的轮播。 i would like to tweak the carousel-caption to something like this (photoshop rendered image) 我想将轮播字幕调整为此类(Photoshop渲染的图像)

希望有一些不透明的渐变

I would love to have some gradient with opacity, to perfectly blend with. 我很想在不透明度上加入一些渐变,以使其完美融合。 vignette also preferable. 小插图也比较可取。 I've never done something this way before. 我以前从未做过这种事。

here'm my code. 这是我的代码。 i've not done any styling than the bootstrap default styles. 除了引导默认样式外,我没有做任何样式。

<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
    <div class="item active">
    <img src="2.jpg" alt="img-responsive">
        <div class="carousel-caption">
            <h2>The worst of me suceeded by the best of You </h2>
        </div>          
    </div>
</div>

and the javascript 和JavaScript

$(document).ready(function(){
    $('.carousel').carousel({
        interval:3000
    })
});

just controls the time intervals. 只是控制时间间隔。 bootstrap 3. 2.jpg is the picture shown. bootstrap 3. 2.jpg是显示的图片。 thanks for your help and sorry for my English. 感谢您的帮助,对不起我的英语。

Here is a fiddle with a quick example of what you can do. 这是一个小提琴,提供了您可以做什么的快速示例。

Fiddle 小提琴

The CSS to make a gradient for webkit (Chrome) looks something like this 为Webkit(Chrome)制作渐变的CSS看起来像这样

background: -webkit-gradient(linear, left top, left bottom, color-stop(20%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,1)));

If you are having troubles figuring out the CSS, take a look at this page for creating the gradients. 如果您在计算CSS时遇到麻烦,请查看此页面以创建渐变。 Its a good start to making your own. 这是制作自己的好起点。 The other stackoverflow post mentioned by @TheLittlePig in the comments is also very useful. @TheLittlePig在评论中提到的另一个stackoverflow帖子也非常有用。

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

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