网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站设计 > CSS, DIV, HTML
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

Reply
 
Thread Tools Display Modes
  #1   IP: 112.84.220.208
Old 2016-11-13, 05:58 PM
Ideal Ideal is offline
初级会员
 
Join Date: 2010-07-07
Posts: 1
Ideal 现在声名狼藉
Default Bootstrap中如何让响应式图片(img-responsive)水平居中

我们在用bootstrap排版内容的时候,有的时候在内容中需要图片水平居中对齐。
一般情况下,我们的图片都使用了 .img-responsive 类来实现响应式图片。如果需要实现响应式图片水平居中,那么我们要使用 .center-block 类,不要用 .text-center
通过 .center-block 类 实现响应式图片水平居中使用方法:
Code:
<p><img class="img-responsive center-block" src="..." /></p>
注:.center-block 类的放置位置。下边两种放置方法都不能实现。
Code:
<p class="center-block"><img class="img-responsive" src="..." /></div>
<div class="center-block"><img class="img-responsive" src="..." /></div>
 
如果图片没有添加响应式类 .img-responsive,那么我们可以使用.text-center来实现图片居中对齐:

Code:
<p class="text-center"><img src="..."></p>
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 3 (0 members and 3 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 07:17 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.