我想在个人元素中使用 Twitter Bootstrap 轮播。 到目前为止,它工作得非常好,因为我使用了 bootstrap 主页的示例。
现在我想在那里放置简单的 html 内容而不是图像。 然后,此内容应以与图片相同的方式旋转。 我输入的文本显示在轮播标题中,而我输入轮播标题的文本未显示。
例子:
<div class="item">
This is the text or html code i want to place
<div class="carousel-caption">
<h4>Thumbnail label</h4>
<p>Carousel caption text<p>
</div>
</div>
有没有办法完成这项工作? 也许有一种方法可以声明一个 300 x 300 像素的白色跨度,我可以在其中放置一些内容。
你应该知道我是初级水平。我现在正在学习html、css、js、mongodb、bootstrap、node.js。但这对我来说有点太多了。
非常感谢 丹尼尔
最佳答案
<head>
<style type="text/css">
div.new_html_code {
width:150px;
height:100px;
min-width:150px;
min-height:100px;
max-width:200px;
max-height:100px;
overflow:hidden;
display:block;
border:1px solid red;
}
</style>
</head>
<body>
<!--
some html stuff here, I am just giving the basic layout
-->
<div class="item">
<div class="new_html_code"></div>
<div class="carousel-caption">
<h4>Thumbnail label</h4>
<p>Carousel caption text<p>
</div>
</div>
</body>
如果您已经替换了 carousel 中的 html/css 并且无法更正它,请取回原始内容。 然后慢慢地开始用您的代码替换,并非常小心以下 css 属性,它们不仅有助于发现错误(如最有用的 css 边框),而且它们还有助于阻止添加的新内容,使以前的内容膨胀一个(最大宽度/高度 css 属性)。
请密切注意以下 css 属性:
min-width:150px;
min-height:100px;
max-width:200px;
max-height:100px;
overflow:hidden;
border:1px solid red;
不要修改 z-indexes 和不透明度,首先使用我上面给出的那些,然后开始做复杂的事情,如果您有任何疑问,请再次询问,对不起,我没有时间。
关于html - Bootstrap Carousel 图像以外的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11914716/