文本居中

text-align:center;

如果是图片放在div中,就没办法了。用flex可以很简单实现。

display: flex;
justify-content: center; /* 图片居中 */

下面是案例:



html

<!-- 优势 -->
<div class="strength">
<div class="strength-title">
创新优势
</div>
<div class="strength-container">
<div class="strength-item">
<div class="strength-item-icon">
<img src="/Index/Index/image/innovate/shenduhezuo.png" alt="">
</div>
<div class="strength-item-title">
产学研深度合作
</div>
<div class="strength-item-content">
力邀世界一流大学科学家加盟,带领研究团队参与企业级创新方案规划。
</div>
</div>
<div class="strength-item">
<div class="strength-item-icon">
<img src="/Index/Index/image/innovate/xianjinlinian.png" alt="">
</div>
<div class="strength-item-title">
先进的实施理念
</div>
<div class="strength-item-content">
以产品思维取代项目思维, 将产品化的理念贯彻到创新的每一个环节,每一个人。
</div>
</div>
<div class="strength-item">
<div class="strength-item-icon">
<img src="/Index/Index/image/innovate/genji.png" alt="">
</div>
<div class="strength-item-title">
牢靠的根基
</div>
<div class="strength-item-content">
先进的云计算技术平台,支撑起以宝尊多年品牌电商运营经验培育的电商云生态平台。
</div>
</div>
<div class="strength-item">
<div class="strength-item-icon">
<img src="/Index/Index/image/innovate/biaozhun.png" alt="">
</div>
<div class="strength-item-title">
标准化能力
</div>
<div class="strength-item-content">
通过标准化的数据,打造标准化的产品,使宝尊具备提供标准化科技服务的能力。
</div>
</div>
</div>
</div>

css

.strength {
height: 518px;
background-color: #F6F8FC;
overflow: hidden;
.strength-title {
margin-top:100px;
font-size: 30px;
font-weight: bold;
text-align: center;
}
.strength-container {
width: 925px;
margin:0 auto;
margin-top:63px;
display: flex;
justify-content: space-between;
.strength-item {
width: 208px;
height: 208px;
//border: 1px solid red;
.strength-item-icon {
display: flex;
justify-content: center; /* 图片居中 */
height: 56px;
}
.strength-item-title {
margin-top: 30px;
font-size: 20px;
font-weight: bold;
text-align: center;
}
.strength-item-content {
margin-top: 23px;
font-size: 16px;
color: #222222;
text-align: center;
}
}
}
}

图片居中的flex实现的更多相关文章

  1. css文字居中、图片居中、div居中解决方案

    一.文字居中 若文字只有一行 <!--html代码--> <div class="box"> <p class="text"> ...

  2. !!!css如何让img图片居中?css的display属性实现图片居中(代码实例)

    在我们开发前端页面的时候,为了让页面效果美观,会让图片呈现居中效果.那么css怎么让img图片居中显示呢?本篇文章给大家带来css如何让img图片居中?css的display属性实现图片居中(代码实例 ...

  3. css图片居中(水平居中和垂直居中)

    css图片居中(水平居中和垂直居中) css图片居中分css图片水平居中和垂直居中两种情况,有时候还需要图片同时水平垂直居中,下面分几种居中情况分别介绍. css图片水平居中 利用margin: 0 ...

  4. HTML/CSS:图片居中(水平居中和垂直居中)

    css图片居中(水平居中和垂直居中) css图片居中分css图片水平居中和垂直居中两种情况,有时候还需要图片同时水平垂直居中, 下面分几种居中情况分别介绍: css图片水平居中 1.利用margin: ...

  5. css图片居中,通过纯css实现图片居中的多种实现方法

    在网页布局中,图文排版是我们常用的,那么经常会遇到如何让图片居中显示呢,这篇文章将总结常用css实现图片居中的方法总结: html结构: <div class="demo" ...

  6. line-height,vertical-align及图片居中对齐问题根源解析

    关于图片居中对齐的问题,进入前端行业虽然有一段时间了,以为自己懂了,可是实际上还是一知半解,找了一些博客来看了一下,但是感觉讲的有点碎,看完还是一知半解. 查阅了一下<css权威指南>,结 ...

  7. Html、Css-----当有文字和图片的时候,需要文字和图片居中,怎么实现?不想文字换行怎么设置

    1 当有文字和图片的时候,需要文字和图片居中,怎么实现? <a href=#" target="aa" style="white-space:nowrap ...

  8. [转]div 让文字或图片居中

    本文转自:http://qsfwy.iteye.com/blog/250206 在div 中让 文字或图片居中,请参考以下代码1: - - - - - - - - - - - - - - - - - ...

  9. 用CSS让网页背景图片居中的方法

    网页背景居中的方法有很多种的.这里介绍一些用CSS让背景图片居中的方法. 让背景图片居中的第一个方法是用像素设定,很多都用这种,但是也是最麻烦的: <div style="width: ...

随机推荐

  1. CCF CSP 202009-2 风险人群筛查

    202009-2 风险人群筛查 题目背景 某地疫情爆发后,出于"应检尽检"的原则,我们想要通知所有近期经过改高危区域的居民参与核酸检测. 问题描述 想要找出经过高危区域的居民,分析 ...

  2. PIE模型

    首先,我们需要明确程序的Bug有如下的定义: 1. Fault/Defect 静态的,存在于软件中的缺陷.例如:一段有缺失或者错误的代码. 2. Error 运行时一种不正确的中间状态. 3. Fai ...

  3. 翻译:《实用的Python编程》README

    欢迎光临 大约 25 年前,当我第一次学习 Python 时,发现 Python 竟然可以被高效地应用到各种混乱的工作项目上,我立即被震惊了.15 年前,我自己也将这种乐趣教授给别人.教学的结果就是本 ...

  4. 阅读笔记:ImageNet Classification with Deep Convolutional Neural Networks

    概要: 本文中的Alexnet神经网络在LSVRC-2010图像分类比赛中得到了第一名和第五名,将120万高分辨率的图像分到1000不同的类别中,分类结果比以往的神经网络的分类都要好.为了训练更快,使 ...

  5. AtCoder Beginner Contest 170

    比赛链接:https://atcoder.jp/contests/abc170 A - Five Variables 题意 $5$ 个数中有 $1$ 个 $0$,判断是第几个. 代码 #include ...

  6. Educational Codeforces Round 88 (Rated for Div. 2) D、Yet Another Yet Another Task

    题意: 给你一个含n个数a1,a2...an的数组,你要找到一个区间[l,r],使得al+a(l+1)+...+a(r-1)+ar减去max(al,a(l+1),...,a(r-1),ar)的值尽可能 ...

  7. 要想用活Redis,Lua脚本是绕不过去的坎

    前言 Redis 当中提供了许多重要的高级特性,比如发布与订阅,Lua 脚本等.Redis 当中也提供了自增的原子命令,但是假如我们需要同时执行好几个命令的同时又想让这些命令保持原子性,该怎么办呢?这 ...

  8. 自动化将 word 转为 pdf,再将pdf转为图片!

    参考: https://blog.csdn.net/ynyn2013/article/details/49120731 https://www.jianshu.com/p/f57cc64b9f5e 一 ...

  9. 鸟哥的linux私房菜——第十二章学习(Shell Scripts)

    第十二章  Shell Scripts 1.0).什么是shell scripts? script 是"脚本.剧本"的意思.整句话是说, shell script 是针对 shel ...

  10. CodeForces - 13E(分块)

    Little Petya likes to play a lot. Most of all he likes to play a game «Holes». This is a game for on ...