作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 bootstrap 和 hover.css 创建一个列表组,其中列表组项是按钮。问题是我无法将这些元素的宽度设置为仅填充其父项的空间。
编辑:问题实际上并不是按钮在容器外。这是列外的容器
在我的 html 中,我目前有:
<div class="col-md-4">
<div class="list-box">
<div class="container">
<h1>Some title</h1>
<div class="list-group">
<button type="button" class="list-group-item hvr-sweep-to-left" ng-repeat="project in currentUser.projects">
{{Something}}
</button>
</div>
</div>
</div>
</div>
在我的 css 中,我目前有:
.list-box
{
background-color: #FFFFFF;
border-color: #000000;
display: block;
}
.list-group-item
{
display: block;
width: 100%;
}
这是我正在使用的 hover.css
/* Button Effect - Sweep To Left */
.hvr-sweep-to-left {
display: block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
position: relative;
-webkit-transition-property: color;
transition-property: color;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
}
.hvr-sweep-to-left:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #4393b9;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-transition-property: transform;
transition-property: transform;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
.hvr-sweep-to-left:hover, .hvr-sweep-to-left:focus, .hvr-sweep-to-left:active {
color: white;
}
.hvr-sweep-to-left:hover:before, .hvr-sweep-to-left:focus:before, .hvr-sweep-to-left:active:before {
-webkit-transform: scaleX(1);
transform: scaleX(1);
}
/* Button Effect - Sweep To Right */
.hvr-sweep-to-right {
display: block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
position: relative;
-webkit-transition-property: color;
transition-property: color;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
}
.hvr-sweep-to-right:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #4393b9;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transform-origin: 0 50%;
transform-origin: 0 50%;
-webkit-transition-property: transform;
transition-property: transform;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
.hvr-sweep-to-right:hover, .hvr-sweep-to-right:focus, .hvr-sweep-to-right:active {
color: white;
}
.hvr-sweep-to-right:hover:before, .hvr-sweep-to-right:focus:before, .hvr-sweep-to-right:active:before {
-webkit-transform: scaleX(1);
transform: scaleX(1);
}
/* Back Pulse */
@-webkit-keyframes hvr-back-pulse {
50% {
background-color: rgba(32, 152, 209, 0.75);
}
}
@keyframes hvr-back-pulse {
50% {
background-color: rgba(32, 152, 209, 0.75);
}
}
.hvr-back-pulse {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
overflow: hidden;
-webkit-transition-duration: 0.5s;
transition-duration: 0.5s;
-webkit-transition-property: color, background-color;
transition-property: color, background-color;
}
.hvr-back-pulse:hover, .hvr-back-pulse:focus, .hvr-back-pulse:active {
-webkit-animation-name: hvr-back-pulse;
animation-name: hvr-back-pulse;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-delay: 0.5s;
animation-delay: 0.5s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
background-color: #2098d1;
background-color: #2098d1;
color: white;
}
最佳答案
我不确定你在找什么。但是,如果您希望列表项填充其父级,则这里是解决方案:
body{width:100%;}
.container
{ background-color: red;
border-color: #000000;
display: block;
padding: 0;
}
h1{font-size:large;}
.list-group-item
{
display: block;
width: 100%;
}
关于html - 编辑 : How do you make a container fill the width of bootstrap col class?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31702547/
我是一名优秀的程序员,十分优秀!