我有一个DIV和一个SPAN。我想将SPAN水平居中放置在DIV中。如何在一个div内水平居中对齐跨度
我想在headerRibbon div中居中,但不管我用什么代码,它都不起作用。
我加载像这样上面所示的移动样式:
<!-- default stylesheets -->
<link rel="stylesheet" type="text/css" href="theStyles/defaultStyle.css" /><link rel="stylesheet" type="text/css" href="theStyles/captionStyle.css" />
<!-- mobile stylesheets
<link rel="stylesheet" type="text/css" href="theStyles/defaultStyle_mobile.css" media="only screen and (max-device-width: 480px) and (min-device-width : 320px)" /><link rel="stylesheet" type="text/css" href="theStyles/captionStyle_mobile.css" media="only screen and (max-device-width: 480px) and (min-device-width : 320px)" />-->
<link rel="stylesheet" media="screen and (max-width: 480px)" href="theStyles/defaultStyle_mobile.css" /><link rel="stylesheet" media="screen and (max-width: 480px)" href="theStyles/captionStyle_mobile.css" />
<!-- if ie version 9 or less -->
<!--[if lte IE 9]>
<link rel="stylesheet" type="text/css" href="theStyles/defaultStyle_ie.css" /><link rel="stylesheet" type="text/css" href="theStyles/captionStyle_ie.css" />
<![endif]-->
一旦滑下在页面加载的div
显示为block
:
我该如何解决?
您是否尝试过跨度显示:inline-block;然后使div文本对齐:中心; ? –
为什么'socialIcons'设置为'display:table',然后还包含一个表格? –
好吧,它适用于我(http://jsfiddle.net/86s8C/)。我猜你的问题是在你的代码中的其他地方.. – Sebsemillia