-2
4

3 に答える 3

1

display: inline要素の寸法を設定することはできません。

display: block幅を明示的に設定する場合は、aとspanの両方を持つことができます。

.footer {position:absolute; bottom:0; width:100%;}
.footer a {display:block; background:orange;} /* no need to center text, here */
.footer a span {
  display: block; /* give it a box layout */
  margin: 0px auto; /* center it horizontally */
  width:100px; /* give it explicit absolute size */
  text-align: center; /* you might center the content here, though */
  background:#FFF; font-size:12px;}

またはtext-align: center、すでに行っているように使用します。

.footer {position:absolute; bottom:0; width:100%;}
.footer a {display:block; background:orange; text-align:center;}
.footer a span {background:#FFF; font-size:12px;
  padding: 0px 30px;} /* if you only want some padding, and not a fixed width
于 2012-12-03T21:23:49.643 に答える
0

次のことを試してください:-

.footer a span {background:#FFF; font-size:12px; 幅:50%; 表示ブロック; マージン:0自動;}

「内側のスパン」には、「外側」のdiv(またはフッター)よりも小さい幅と、自動整列するためのマージン:0設定が必要です。

于 2012-12-03T21:24:21.097 に答える
-4

できるよ

<center> </center>

だからこのように、

<div class="footer">
<center>
 <a href="#">
      <span>Show/Hide</span>
 </a>
</center>
</div>
于 2012-12-03T21:21:38.690 に答える