简体   繁体   English

Bootstrap 3叠加字幕未正确对齐

[英]Bootstrap 3 Overlay caption not aligned properly

I have created a pintrest style grid in bootstrap and in that i want to display overlay caption text on top right corner and on bottom side 我在bootstrap创建了一个pintrest样式网格,在该网格中,我想在右上角和底侧显示叠加字幕文本

But as you can see in the demo here that my top right corner label is not aligned properly and same for bottom text as well 但是正如您在演示中所看到的,我的右上角标签未正确对齐,底部文本也相同

Even when i write text in multiline it doesnt fit in well. 即使当我用多行文字书写时,它也不太适合。 I want the miltiline text to be display like this below image 我希望在下面的图像中显示军事文字

在此处输入图片说明

Also wants to fit the grid according to image,right now it gives some extra width after the image width. 也要根据图像调整网格,现在它在图像宽度之后提供了一些额外的宽度。

So what css property should i adjust here? 那么我应该在这里调整哪些css属性?

CSS 的CSS

.row {
    -moz-column-width: 18em;
    -webkit-column-width: 18em;
    -moz-column-gap: 1em;
    -webkit-column-gap:1em;
}
.item {
    display: inline-block;
    width: 100%;
}
.well {
    position:relative;
    display: block;
    padding: 0;
}
.well span {
    position: absolute;
    right: 0;
    top: 0;
    padding:1%;
    color: #fff;
    background:rgba(0, 0, 0, 0.50);
}
.well h4 {
    position: absolute;
    left: 0;
    bottom: 0;
    margin: 0;
    padding:1%;
    color: #fff;
    background:rgba(0, 0, 0, 0.50);
    width: 100%;
    padding: 15px;
}

For a full width, cover image on each item, add width:100% to the <img/> elements. 要获得全宽,请在每个项目上覆盖图像,然后在<img/>元素中添加width:100%

.well img {
    width:100%;
}

Demo: https://jsfiddle.net/9dz3xxe9/1/ 演示: https : //jsfiddle.net/9dz3xxe9/1/

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

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