我有一个带有<li>
标签的引导程序模板的产品列表:
<div class="category-products">
<ol class="products-list" id="products-list">
<li class="item first">
<div class="product-image"> <a href="#"> <img class="small-image" src="IMAGE.jpg" width="230"> </a> </div>
<div class="product-shop">
<h2 class="product-name"><a href="#">PRODUCTNAME</a></h2>
<div class="price-box">
<p class="old-price"> <span class="price-label"></span> <span id="old-price-212" class="price"> XXXXX </span> </p>
<p class="special-price"> <span class="price-label"></span> <span class="price"> XXXXX </span> </p>
</div>
<div class="desc std">
<p>DESCRIPTION</p>
</div>
</div>
</li>
</ol>
</div>
现在我想要一个标签&#34;新产品&#34;在右下角。我该怎么做?
Bootstrap有这样的标准标签:
<span class="label label-info">Info</span>
但不在角落里。)
答案 0 :(得分:1)
您可以使用引导样式:jsfiddle
<div class="category-products">
<ol class="products-list" id="products-list">
<li class="item first">
<div class="product-image"> <a href="#"> <img class="small-image" src="IMAGE.jpg" width="230"> </a> </div>
<div class="product-shop">
<h2 class="product-name"><a href="#">PRODUCTNAME</a></h2>
<div class="price-box">
<p class="old-price"> <span class="price-label"></span> <span id="old-price-212" class="price"> XXXXX </span> </p>
<p class="special-price"> <span class="price-label"></span> <span class="price"> XXXXX </span> </p>
</div>
<div class="desc std">
<p>DESCRIPTION</p>
</div>
</div>
<a href="#"><span class="label label-info pull-right">New Product</span></a>
</li>
</ol>
答案 1 :(得分:0)
你可以在右边的样式中使用
见这里: Example
<div class="category-products">
<ol class="products-list" id="products-list">
<li class="item first">
<div class="product-image"> <a href="#"> <img class="small-image" src="IMAGE.jpg" width="230"> </a> </div>
<div class="product-shop">
<h2 class="product-name"><a href="#">PRODUCTNAME</a></h2>
<div class="price-box">
<p class="old-price"> <span class="price-label"></span> <span id="old-price-212" class="price"> XXXXX </span> </p>
<p class="special-price"> <span class="price-label"></span> <span class="price"> XXXXX </span> </p>
</div>
<div class="desc std">
<p>DESCRIPTION</p>
</div>
<span class="label label-info" style="float: right" >Info</span>
</div>
</li>
</ol>
答案 2 :(得分:0)
这就是你要追求的吗?
.products-list>.item {
margin: 15px 15px 0 0;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .2), 0 1px 1px 0 rgba(0, 0, 0, .14), 0 2px 1px -1px rgba(0, 0, 0, .12);
width: 260px;
float: left;
padding: 15px;
position: relative;
border-radius: 4px;
}
.products-list>.item .product-image {
margin: -15px -15px 0;
border-radius: 4px 4px 0 0;
overflow: hidden;
}
.products-list>.item .product-image>a {
width: 100%;
}
.products-list>.item span.label {
position: absolute;
bottom: 0;
right: 0;
padding: 5px 12px;
border-radius: 4px 0;
}
ol,
ul>li {
list-style-type: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<div class="category-products">
<ol class="products-list" id="products-list">
<li class="item first">
<div class="product-image">
<a href="#">
<img class="small-image" src="http://placehold.it/260x150">
</a>
</div>
<div class="product-shop">
<h2 class="product-name"><a href="#">PRODUCTNAME</a></h2>
<div class="price-box">
<p class="old-price"> <span class="price-label"></span> <span id="old-price-212" class="price"> XXXXX </span>
</p>
<p class="special-price"> <span class="price-label"></span> <span class="price"> XXXXX </span>
</p>
</div>
<div class="desc std">
<p>DESCRIPTION</p>
<span class="label label-info">New Product</span>
</div>
</div>
</li>
<li class="item first">
<div class="product-image">
<a href="#">
<img class="small-image" src="http://placehold.it/260x150" width="260">
</a>
</div>
<div class="product-shop">
<h2 class="product-name"><a href="#">PRODUCTNAME</a></h2>
<div class="price-box">
<p class="old-price"> <span class="price-label"></span> <span id="old-price-212" class="price"> XXXXX </span>
</p>
<p class="special-price"> <span class="price-label"></span> <span class="price"> XXXXX </span>
</p>
</div>
<div class="desc std">
<p>DESCRIPTION</p>
<span class="label label-info">New Product</span>
</div>
</div>
</li>
<li class="item first">
<div class="product-image">
<a href="#">
<img class="small-image" src="http://placehold.it/260x150">
</a>
</div>
<div class="product-shop">
<h2 class="product-name"><a href="#">PRODUCTNAME</a></h2>
<div class="price-box">
<p class="old-price"> <span class="price-label"></span> <span id="old-price-212" class="price"> XXXXX </span>
</p>
<p class="special-price"> <span class="price-label"></span> <span class="price"> XXXXX </span>
</p>
</div>
<div class="desc std">
<p>DESCRIPTION</p>
<span class="label label-info">New Product</span>
</div>
</div>
</li>
<li class="item first">
<div class="product-image">
<a href="#">
<img class="small-image" src="http://placehold.it/260x150">
</a>
</div>
<div class="product-shop">
<h2 class="product-name"><a href="#">PRODUCTNAME</a></h2>
<div class="price-box">
<p class="old-price"> <span class="price-label"></span> <span id="old-price-212" class="price"> XXXXX </span>
</p>
<p class="special-price"> <span class="price-label"></span> <span class="price"> XXXXX </span>
</p>
</div>
<div class="desc std">
<p>DESCRIPTION</p>
<span class="label label-info">New Product</span>
</div>
</div>
</li>
</ol>
</div>
相关部分:
.products-list>.item {
position: relative;
}
.products-list>.item span.label {
position: absolute;
bottom: 0;
right: 0;
}
代码假定您的标签已在您的说明中。如果它们不是,它们可以即时生成,但是你想要的问题并不清楚。