图片居中的flex实现
文本居中
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实现的更多相关文章
- css文字居中、图片居中、div居中解决方案
一.文字居中 若文字只有一行 <!--html代码--> <div class="box"> <p class="text"> ...
- !!!css如何让img图片居中?css的display属性实现图片居中(代码实例)
在我们开发前端页面的时候,为了让页面效果美观,会让图片呈现居中效果.那么css怎么让img图片居中显示呢?本篇文章给大家带来css如何让img图片居中?css的display属性实现图片居中(代码实例 ...
- css图片居中(水平居中和垂直居中)
css图片居中(水平居中和垂直居中) css图片居中分css图片水平居中和垂直居中两种情况,有时候还需要图片同时水平垂直居中,下面分几种居中情况分别介绍. css图片水平居中 利用margin: 0 ...
- HTML/CSS:图片居中(水平居中和垂直居中)
css图片居中(水平居中和垂直居中) css图片居中分css图片水平居中和垂直居中两种情况,有时候还需要图片同时水平垂直居中, 下面分几种居中情况分别介绍: css图片水平居中 1.利用margin: ...
- css图片居中,通过纯css实现图片居中的多种实现方法
在网页布局中,图文排版是我们常用的,那么经常会遇到如何让图片居中显示呢,这篇文章将总结常用css实现图片居中的方法总结: html结构: <div class="demo" ...
- line-height,vertical-align及图片居中对齐问题根源解析
关于图片居中对齐的问题,进入前端行业虽然有一段时间了,以为自己懂了,可是实际上还是一知半解,找了一些博客来看了一下,但是感觉讲的有点碎,看完还是一知半解. 查阅了一下<css权威指南>,结 ...
- Html、Css-----当有文字和图片的时候,需要文字和图片居中,怎么实现?不想文字换行怎么设置
1 当有文字和图片的时候,需要文字和图片居中,怎么实现? <a href=#" target="aa" style="white-space:nowrap ...
- [转]div 让文字或图片居中
本文转自:http://qsfwy.iteye.com/blog/250206 在div 中让 文字或图片居中,请参考以下代码1: - - - - - - - - - - - - - - - - - ...
- 用CSS让网页背景图片居中的方法
网页背景居中的方法有很多种的.这里介绍一些用CSS让背景图片居中的方法. 让背景图片居中的第一个方法是用像素设定,很多都用这种,但是也是最麻烦的: <div style="width: ...
随机推荐
- js截取+全部替换+字符串
//将关键字标志显示到页面中 function showKeyWord(showStr) { var keyword = $("#keyword").val();//页面中的关键字 ...
- C++泛型基础学习
转载http://blog.csdn.net/xinzheng_wang/article/details/6674847 泛型的基本思想:泛型编程(Generic Programming)是一种语言机 ...
- OpenStack (云计算与openstck简介)
云计算 什么是云计算 云计算是一种按使用量付费的模式,这种模式提供可用的,便捷的,按需的网络访问,通过互联网进入可配置的计算资源共享池(资源包括,计算,存储,应用软件和服务) 云计算的特征 易于管理: ...
- JDK-7新特性,更优雅的关闭流-java try-with-resource语句使用
前言 公司最近代码质量整改,需要对大方法进行调整,降低到50行以下,对方法的深度进行降低,然后有些文件涉及到流操作,很多try/catch/finally语句,导致行数超出规范值,使用这个语法可以很好 ...
- Codeforces Global Round 9 C. Element Extermination
题目链接:https://codeforces.com/contest/1375/problem/C 题意 给出一个大小为 $n$ 的排列 $a$,如果 $a_i < a_{i+1}$,则可以选 ...
- Codeforces Round #622 (Div. 2) C2. Skyscrapers (hard version)(单调栈,递推)
Codeforces Round #622 (Div. 2) C2. Skyscrapers (hard version) 题意: 你是一名建筑工程师,现给出 n 幢建筑的预计建设高度,你想建成峰状, ...
- 【poj 2115】C Looooops(数论--拓展欧几里德 求解同余方程 模版题)
题意:有一个在k位无符号整数下的模型:for (variable = A; variable != B; variable += C) statement; 问循环的次数,若"永不停息&q ...
- codeforces578C. Weakness and Poorness
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- vlc音视频开发(一)环境搭建(qt篇)
来源:微信公众号「编程学习基地」 目录 简介 qt配置vlc环境 simple_libvlc_qt_player 项目地址 简介 VLC 是一款自由.开源的跨平台多媒体播放器及框架,可播放大多数多媒体 ...
- MySQL菜鸟实录(一):MySQL服务安装实战
CentOS 7 基本信息 系统版本: CentOS 7.3 64bit 系统配置: 4vCPUs | 8GB 磁盘空间: [root@ecs-ce5a-0001 ~]# df -h Filesyst ...