gpt4 book ai didi

twitter-bootstrap - Bootstrap : centering the columns in fluid row

转载 作者:太空宇宙 更新时间:2023-11-04 02:52:12 25 4
gpt4 key购买 nike

(09/30/2015) 在底部添加了此问题的解决方案

我一直在搜索和使用 CSS 文件,但我似乎无法正确理解它,相反,我只是用糟糕的解决方案修补 css。

当前设置

我和<div class="row-fluid">吵架了这一行有 24 列 div <div class="col-xs-1 skills-item"> .当我在桌面上时它看起来不错,但当我在移动设备上时,它们会四处移动并设置丑陋的居中位置。

我想使用 row-fluid选项,因为我不希望 24 列堆叠并占用太多空间。

见下图。

全屏

Full Screen

较小的屏幕

Smaller Screen

更小的屏幕

Even Smaller Screen

移动

Mobile

我做了什么

我添加了媒体查询来处理不同的屏幕尺寸,但我确信这是一种硬编码方式,我应该尽可能避免。这是片段

@media(max-width:1000px) {
#skills .skills-item {
margin-right: 30px;
}
}

@media(min-width: 1001px) and (max-width: 1200px){
#skills .skills-item {
margin-right: 30px;
margin-left: 5px;
}
}

@media(max-width: 767px) {
#skills .skills-item {
margin-right: 55px;
margin-left: 15px;
}
}

@media(max-width: 466px) {
#skills .skills-item {
margin-right: 40px;
margin-left: 40px;
}
}

@media(max-width: 376px) {
#skills .skills-item {
margin-right: 40px;
margin-left: 30px;
}
}

我的意思是这可行,但在某些尺寸上看起来仍然很难看。

问题

是否有任何干净的解决方案可以使这些列居中?

类似于 margin: 0 auto;并将所有这些都居中是完美的,但它没有用。 (或者也许我只是找不到放在哪里)

我做的网站上线了,测试用的(根本没完工)Here

谢谢!

编辑:添加了 html 和 css

此部分的

HTML 代码。我很确定您不需要所有 24 项,但这里就是。

    <!-- Skill Overview -->
<section class="success" id="skills">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Skill Overview</h2>
<hr class="skills-hr">
</div>
</div>
<div class="row-fluid">
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">JAVA</span>
<span class="skill-name" style="font-size:150%;">JAVA</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">C</span>
<span class="skill-name" style="font-size:150%;">C</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">C++</span>
<span class="skill-name" style="font-size:150%;">C++</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">C#</span>
<span class="skill-name" style="font-size:150%;">C#</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link" style="padding-top:30px">
<span class="skill-icon" style="color:#fff;">PYTHON</span>
<span class="skill-name">PYTHON</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link" style="padding-top:30px">
<span class="skill-icon" style="color:#fff;">SPARC</span>
<span class="skill-name two-lines" style="font-size:90%">SPARC ASSEMBLY</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link" style="padding-top:30px">
<span class="skill-icon" style="font-size:120%; color:#fff;">MIPS</span>
<span class="skill-name two-lines" style="font-size:90%">MIPS ASSEMBLY</span>
</div>
</div>

<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-android fa-2x"></i>
<span class="skill-name icon-one-line">ANDROID</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-html5 fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">HTML5</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-css3 fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">CSS3</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">JS</span>
<span class="skill-name icon-one-line" style="font-size:90%">JAVASCRIPT</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="php" class="skill-icon" src="images/php-logo.png" style="width:80%; margin-top:-10px">
<span class="skill-name">PHP SCRIPT</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="apache" class="skill-icon" src="images/apache-logo.png" style="width:75%;">
<span class="skill-name">APACHE SERVER</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-database fa-2x"></i>
<span class="skill-name" style="font-size:90%">SQL DATABASE</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="aws" class="skill-icon" src="images/aws-logo.png" style="width:50%;">
<span class="skill-name" style="font-size:85%">Amazon Web Services</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-linux fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">LINUX</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-apple fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">OSX</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-windows fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:90%;">WINDOWS</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-git fa-2x"></i>
<span class="skill-name" style="font-size:75%">VERSION CONTROL <br>(GIT, SVN)</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="eclipse" class="skill-icon" src="images/eclipse-logo.png" style="width:40%;">
<span class="skill-name icon-one-line">ECLIPSE</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="unity3d" class="skill-icon" src="images/unity3d-logo.png" style="width:40%;">
<span class="skill-name icon-one-line">UNITY3D</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="gdb" class="skill-icon" src="images/gdb-logo.png" style="width:70%; margin-top:-15px">
<span class="skill-name icon-one-line" style="font-size:120%;">GDB</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-stack-exchange fa-2x"></i>
<span class="skill-name two-lines" style="font-size:90%;">STACK EXCHANGE</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-pulse-grow skills-link skill-love">
<i class="skill-icon fa fa-heart fa-2x"></i>
<span class="skill-name icon-one-line" style="color: #000; font-size: 120%"><b>LOVE</b></span>
</div>
</div>
</div>
</div>
</section>
<!-- /Skill Overview -->

CSS 部分

/* Skill Settings */
.skill-name {
color: #fff;
display: none;
}


.skills-link:hover .skill-name {
display: table;
margin: 0 auto;
}

.skills-link:hover .two-lines {
margin-top: -5px;
}

.skills-link:hover .icon-one-line {
padding-top: 5px;
}

.skills-link:hover .skill-icon{
display: none;
}

#skills .skills-item {
right: 0;
margin-top: 15px;
}


#skills .skills-item .skills-link {
display: block;
position: relative;
margin: 0 auto;
width: 80px;
height: 80px;
background-color: #0F1A23;
text-align: center;
padding-top: 25px;
}

#skills .skills-link:hover {
background-color: #000;
-webkit-transition: all ease 1.25s;
-moz-transition: all ease 1.25s;
transition: all ease 1.25s;
}

#skills .skill-love:hover {
background-color: #FF0000;
-webkit-transition: all ease 1.25s;
-moz-transition: all ease 1.25s;
transition: all ease 1.25s;
}

#skills * {
z-index: 2;
}

@media(max-width:1000px) {
#skills .skills-item {
margin-right: 30px;
}
}

@media(min-width: 1001px) and (max-width: 1200px){
#skills .skills-item {
margin-right: 30px;
margin-left: 5px;
}
}

@media(max-width: 767px) {
#skills .skills-item {
margin-right: 55px;
margin-left: 15px;
}
}

@media(max-width: 466px) {
#skills .skills-item {
margin-right: 40px;
margin-left: 40px;
}
}

@media(max-width: 376px) {
#skills .skills-item {
margin-right: 40px;
margin-left: 30px;
}
}

/* End Skill Settings */

解决方案

index.html

    <!-- Skill Overview -->
<section class="success" id="skills">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Skill Overview</h2>
<hr class="skills-hr">
</div>
</div>
<!-- notice that I changed it from row-fluid to row-->
<!-- also I changed each columns from col-xs-1 to col-sm-1 -->
<div class="row">
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">JAVA</span>
<span class="skill-name" style="font-size:150%;">JAVA</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">C</span>
<span class="skill-name" style="font-size:150%;">C</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">C++</span>
<span class="skill-name" style="font-size:150%;">C++</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">C#</span>
<span class="skill-name" style="font-size:150%;">C#</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link" style="padding-top:30px">
<span class="skill-icon" style="color:#fff;">PYTHON</span>
<span class="skill-name">PYTHON</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link" style="padding-top:30px">
<span class="skill-icon" style="color:#fff;">SPARC</span>
<span class="skill-name two-lines" style="font-size:90%">SPARC ASSEMBLY</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link" style="padding-top:30px">
<span class="skill-icon" style="font-size:120%; color:#fff;">MIPS</span>
<span class="skill-name two-lines" style="font-size:90%">MIPS ASSEMBLY</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-android fa-2x"></i>
<span class="skill-name icon-one-line">ANDROID</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-html5 fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">HTML5</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-css3 fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">CSS3</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">JS</span>
<span class="skill-name icon-one-line" style="font-size:90%">JAVASCRIPT</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="php" class="skill-icon" src="images/php-logo.png" style="width:80%; margin-top:-10px">
<span class="skill-name">PHP SCRIPT</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="apache" class="skill-icon" src="images/apache-logo.png" style="width:75%;">
<span class="skill-name">APACHE SERVER</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-database fa-2x"></i>
<span class="skill-name" style="font-size:90%">SQL DATABASE</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="aws" class="skill-icon" src="images/aws-logo.png" style="width:50%;">
<span class="skill-name" style="font-size:85%">Amazon Web Services</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-linux fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">LINUX</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-apple fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">OSX</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-windows fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:90%;">WINDOWS</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-git fa-2x"></i>
<span class="skill-name" style="font-size:75%">VERSION CONTROL <br>(GIT, SVN)</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="eclipse" class="skill-icon" src="images/eclipse-logo.png" style="width:40%;">
<span class="skill-name icon-one-line">ECLIPSE</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="unity3d" class="skill-icon" src="images/unity3d-logo.png" style="width:40%;">
<span class="skill-name icon-one-line">UNITY3D</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="gdb" class="skill-icon" src="images/gdb-logo.png" style="width:70%; margin-top:-15px">
<span class="skill-name icon-one-line" style="font-size:120%;">GDB</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-stack-exchange fa-2x"></i>
<span class="skill-name two-lines" style="font-size:90%;">STACK EXCHANGE</span>
</div>
</div>
<div class="col-sm-1 skills-item">
<div class="hvr-pulse-grow skills-link skill-love">
<i class="skill-icon fa fa-heart fa-2x"></i>
<span class="skill-name icon-one-line" style="color: #000; font-size: 120%"><b>LOVE</b></span>
</div>
</div>
</div>
</div>
</section>
<!-- /Skill Overview -->

样式表.css

/* Skill Settings */
.skill-name {
color: #fff;
display: none;
}

.skills-link:hover .skill-name {
display: table;
margin: 0 auto;
}

.skills-link:hover .two-lines {
margin-top: -5px;
}

.skills-link:hover .icon-one-line {
padding-top: 5px;
}

.skills-link:hover .skill-icon {
display: none;
}

#skills {
text-align: center;
}

#skills .skills-item {
right: 0;
margin-top: 0px;
display: inline-block;
width: 95px;
height:95px;
overflow: hidden;
}

#skills .skills-item .skills-link {
display: block;
position: relative;
margin: 0 auto;
width: 80px;
height: 80px;
background-color: #0F1A23;
text-align: center;
padding-top: 25px;
box-sizing: border-box;
}

#skills .skills-link:hover {
background-color: #000;
-webkit-transition: all ease 1.25s;
-moz-transition: all ease 1.25s;
transition: all ease 1.25s;
}

#skills .skill-love:hover {
background-color: #FF0000;
-webkit-transition: all ease 1.25s;
-moz-transition: all ease 1.25s;
transition: all ease 1.25s;
}

#skills * {
z-index: 2;
}

.col-sm-1 {
padding: 0;
}
/* End Skill Settings */

截图

desktop

tablets

phones

最佳答案

这是根据您的代码修改的有效解决方案。

CSS

/* Skill Settings */
.skill-name {
color: #fff;
display: none;
}


.skills-link:hover .skill-name {
display: table;
margin: 0 auto;
}

.skills-link:hover .two-lines {
margin-top: -5px;
}

.skills-link:hover .icon-one-line {
padding-top: 5px;
}

.skills-link:hover .skill-icon{
display: none;
}
#skills{
text-align: center;
}
#skills .skills-item {
right: 0;
margin-top: 0px;
display: inline-block;
width: 80px;
height: 80px;
overflow: hidden;
}


#skills .skills-item .skills-link {
display: block;
position: relative;
margin: 0 auto;
width: 80px;
height: 80px;
background-color: #0F1A23;
text-align: center;
padding-top: 25px;
box-sizing: border-box;
}

#skills .skills-link:hover {
background-color: #000;
-webkit-transition: all ease 1.25s;
-moz-transition: all ease 1.25s;
transition: all ease 1.25s;
}

#skills .skill-love:hover {
background-color: #FF0000;
-webkit-transition: all ease 1.25s;
-moz-transition: all ease 1.25s;
transition: all ease 1.25s;
}

#skills * {
z-index: 2;
}

/* End Skill Settings */

HTML

<!-- Skill Overview -->
<section class="success" id="skills">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Skill Overview</h2>
<hr class="skills-hr">
</div>
</div>
<div class="row-fluid">
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">JAVA</span>
<span class="skill-name" style="font-size:150%;">JAVA</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">C</span>
<span class="skill-name" style="font-size:150%;">C</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">C++</span>
<span class="skill-name" style="font-size:150%;">C++</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">C#</span>
<span class="skill-name" style="font-size:150%;">C#</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link" style="padding-top:30px">
<span class="skill-icon" style="color:#fff;">PYTHON</span>
<span class="skill-name">PYTHON</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link" style="padding-top:30px">
<span class="skill-icon" style="color:#fff;">SPARC</span>
<span class="skill-name two-lines" style="font-size:90%">SPARC ASSEMBLY</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link" style="padding-top:30px">
<span class="skill-icon" style="font-size:120%; color:#fff;">MIPS</span>
<span class="skill-name two-lines" style="font-size:90%">MIPS ASSEMBLY</span>
</div>
</div>

<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-android fa-2x"></i>
<span class="skill-name icon-one-line">ANDROID</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-html5 fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">HTML5</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-css3 fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">CSS3</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<span class="skill-icon" style="font-size:150%; color:#fff;">JS</span>
<span class="skill-name icon-one-line" style="font-size:90%">JAVASCRIPT</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="php" class="skill-icon" src="images/php-logo.png" style="width:80%; margin-top:-10px">
<span class="skill-name">PHP SCRIPT</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="apache" class="skill-icon" src="images/apache-logo.png" style="width:75%;">
<span class="skill-name">APACHE SERVER</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-database fa-2x"></i>
<span class="skill-name" style="font-size:90%">SQL DATABASE</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="aws" class="skill-icon" src="images/aws-logo.png" style="width:50%;">
<span class="skill-name" style="font-size:85%">Amazon Web Services</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-linux fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">LINUX</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-apple fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:120%;">OSX</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-windows fa-2x"></i>
<span class="skill-name icon-one-line" style="font-size:90%;">WINDOWS</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-git fa-2x"></i>
<span class="skill-name" style="font-size:75%">VERSION CONTROL <br>(GIT, SVN)</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="eclipse" class="skill-icon" src="images/eclipse-logo.png" style="width:40%;">
<span class="skill-name icon-one-line">ECLIPSE</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="unity3d" class="skill-icon" src="images/unity3d-logo.png" style="width:40%;">
<span class="skill-name icon-one-line">UNITY3D</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<img alt="gdb" class="skill-icon" src="images/gdb-logo.png" style="width:70%; margin-top:-15px">
<span class="skill-name icon-one-line" style="font-size:120%;">GDB</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-float-shadow skills-link">
<i class="skill-icon fa fa-stack-exchange fa-2x"></i>
<span class="skill-name two-lines" style="font-size:90%;">STACK EXCHANGE</span>
</div>
</div>
<div class="col-xs-1 skills-item">
<div class="hvr-pulse-grow skills-link skill-love">
<i class="skill-icon fa fa-heart fa-2x"></i>
<span class="skill-name icon-one-line" style="color: #000; font-size: 120%"><b>LOVE</b></span>
</div>
</div>
</div>
</div>
</section>
<!-- /Skill Overview -->

https://jsfiddle.net/or10qmkk/

您在设置方式上遇到了一些问题,例如您的链接因填充而疯狂流血,因为您从未设置边框,因此您的高度各不相同。从那里我将 .skills-item 设置为内联 block ,并将 #skills div 设置为 text-align center 以使它们居中。

如果您有任何问题,请在评论中告诉我。

关于twitter-bootstrap - Bootstrap : centering the columns in fluid row,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32792398/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com