0

css/html に問題があり、解決が困難です。以下のように、リンクとその中に h2 があるとしましょう

1本線と2本線の線がある画像

コードは次のとおりです。

<a href="newLink"><h2>This can be one line or two lines or three..</h2></a>

以下のように行を下に揃える必要があります...また、テキストが下だけでなく中央にも配置されていることに注意してください。これを行う方法?

                                    Andis AGC Clipper Single
Andis AGC 2 Speed Clipper                     Speed
4

2 に答える 2

2

HTML

<div>
 <h2>one line</h2>
   <h2>This can be one line or two lines or three..</h2>
</div>

CSS

div{background:grey; width:100%}
h2{
  font-size:20px; 
  color:white; width:49%; 
  background:red;
  display:inline-block;
  text-align:center
}

デモ

于 2013-01-25T10:24:20.373 に答える
1

HTML

<div>
 <h2>one line</h2>
  <h2 align=center>This can be one line or two lines or three..</h2>
</div>

CSS

div{background:grey; width:100%}
h2{
  font-size:20px; 
  color:white; width:49%; 
  display:inline-block
}

中央揃えの Sowmya デモを編集しました。

于 2013-01-25T10:33:55.443 に答える