【发布时间】:2014-07-03 00:46:36
【问题描述】:
我有以下fiddle
HTML 由 javascript 创建。如果需要,我可以将样式添加/更改为div's,但我无法更改 HTML 代码的顺序。
我知道我可以使用:
text-align: center;
但是有一个问题 :) 包含 4 张图像的 div 放在 HTML 代码中 <h3> 之前。由于我无法编辑HTML 订单,我想通过使用margin-top: 70px; 的图像降低DIV 问题是这对<h3> 中的文本有影响,而centered 不再是centered。
如何解决这个问题? (使用 css3 的首选)
如果需要更改HTML 中DIV's 的值以修复它,那也没关系
(我可以改变它们)
非常感谢
HTML 代码:
<div class="solitaireprefs" style="position: absolute; left: 0px; top: 0px; width: 80%; height: 80%; z-index: 100;">
<form method="get" action="">
<div style="float: right; margin-top: 70px; display: table; vertical-align: bottom;">
<div><img src="cardsets/test/spades1.svg" alt="Ace spades" align="bottom" style="vertical-align: bottom; width: 119px; height: 166px;"><img src="cardsets/test/clubs7.svg" alt="7 clubs" align="bottom" style="vertical-align: bottom; width: 119px; height: 166px;"></div>
<div><img src="cardsets/test/hearts12.svg" alt="Queen hearts" align="bottom" style="vertical-align: bottom; width: 119px; height: 166px;"><img src="cardsets/test/backred.svg" alt="Card" align="bottom" style="vertical-align: bottom; width: 119px; height: 166px;"></div>
</div>
<h3>Options</h3>
<h4>Images for size 119</h4>
</form>
</div>
CSS:
div.solitaireprefs {
background-color: #fff;
border-radius: 7px;
border: 1px solid #ddd;
}
div.solitaireprefs form {
padding: 0 15px;
}
div.solitaireprefs h3 {
background: #e9e9e9;
margin: 0 -15px;
padding: .7em 0;
text-align: center;
border-radius: 7px 7px 0 0 ;
}
【问题讨论】:
-
在您的问题中发布您的代码。
-
@j08691 小提琴怎么了?
-
@SmokeyPHP - 如果 jsFiddle 无法访问,那么这个问题,没有代码,就失去了它的价值。首先在问题中编码,然后是小提琴。
-
@j08691 我认为这个问题在链接可能失效的时间之后对其他人没有用处,但是好吧 - 很公平,我猜