[英]How can I add flexbox on my Wordpress Site
大家好,我想在我的wordpress网站上应用flexbox。
根据我所知道的,Flexbox是“ Flexible Box Layout Module”(Flexible Box Layout模块)的缩写,它是由World Wide Web Consortium标准化的CSS3模块。
因此,我无需安装任何东西,兼容的浏览器本身支持它,但由于某些原因,它无法在我的网站上运行: http : //americanbitcoinacademy.com/course-list/
目前,我在代码上使用了flex:
<div class="flex">
<div class="col-1-3">
<img src="http://americanbitcoinacademy.com/wp-content/uploads/2017/01/The-Bitcoin-Transaction-Landscape.jpg" />
<h3 style="text-align: center;">BC 101 - The Bitcoin Transaction COURSE</h3>
<p>This course covers the basics of what Bitcoin is and how the Blockchain works, how to use a Bitcoin Wallet and why Bitcoin is important.</p>
<a href="https://xt348.infusionsoft.com/app/orderForms/The-Bitcoin-Transaction" target="_blank"><button class="btn btn-block btn-primary">PURCHASE COURSE →</button></a>
</div>
</div>
.col-1-3 {
padding: 10px;
width: 28%;
float: left;
margin: 2.5%;
border: 1px solid #dedede;
-webkit-border-radius: 7px;
-moz-border-radius: 7px;
border-radius: 7px;
padding-bottom: 0px;
font-family: 'Lato', Verdana;
}
.col-1-3 img {
width: 100%;
}
.col-1-3 img {
width: 100%;
}
a {
margin: 0;
}
h3 {
margin: 15px auto;
font-size: 16px;
font-weight: bold;
text-transform: uppercase;
}
p{
line-height: 16px;
margin: 10px auto;
}
h4 {
margin: 0 0 20px 0;
}
}
.btn-block {
display: block;
width: 100%;
margin-top: 22px;
background: #DD374D;
}
button.btn-block{
background: #DD374D;
font-family: 'Roboto';
margin-bottom: 10px;
font-weight: bold;
}
}
@media only screen and (max-width: 767px) {
.col-1-3 {
width: 44%;
}
}
@media only screen and (max-width: 590px) {
.col-1-3 {
width: 94%;
}
}
.flex {
display: flex;
flex-wrap: wrap;
}
默认情况下,哪个方法可以使框的大小相等,而该页面上的内容不重要。 知道为什么flexbox不起作用吗?
先感谢您。
您的代码有效。 您可能未在支持Flex Box的浏览器中进行测试: http : //caniuse.com/#search=flexbox
要将按钮对齐到底部:
.col-1-3 {
position: relative;
padding-bottom: 40px; /* offset height of button */
}
button.btn-block{
position: absolute;
bottom: 0px;
width: calc(100% - 20px);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.