2017-02-09 3 views
2

screenshot of wrapped lines with deviant indentationhtml、それをはっきりと整列させるには?

私はそれをはっきりと整列させたいが、私はできない。私はそれのために何をすべきですか?

<html> 
<head> 
<style type="text/css"> 
    .article-topic-list a { 
     color: black; 
     text-decoration: none; 
     margin-left: 15px; 
     margin-top: 20px; 
    }`enter code here` 
</style> 
</head> 
<body> 
<div class="article-topic-list"> <a href="">Sale of Kodi TV boxes faces <br> legal test</a> </div> 
<div class="article-topic-list"> <a href="">Piracy fighters battle Kodi 'epidemic'</a></div> 
</body> 
</html> 

答えて

0

タグにCSSルールを適用する代わりに、ルール全体をdivに適用すると正しく整列するはずです。あなたのスタイルスクリプトは次のようになります:

<style type="text/css"> 
.article-topic-list { 
    color: black; 
    text-decoration: none; 
    margin-left: 15px; 
    margin-top: 20px; 
} 
</style> 

出力はthisのようになります。

1

あなたが求めている結果を得るには、designwiseでは、余白スタイルをdivに移動し、aタグに色とテキストの装飾を付ける必要があります。スタイルタグから 'a'を単に削除すると、ブラウザのスタイル(直接a)が優先されるため、色やテキストの装飾の変更は行われません。

.article-topic-list { 
 
    margin-left: 15px; 
 
    margin-top: 20px; 
 
} 
 
.article-topic-list a { 
 
    color: black; 
 
    text-decoration: none; 
 
}
<body> 
 
    <div class="article-topic-list"> 
 
    <a href="">Sale of Kodi TV boxes faces <br> legal test</a> 
 
    </div> 
 
    <div class="article-topic-list"> 
 
    <a href="">Piracy fighters battle Kodi 'epidemic'</a> 
 
    </div> 
 
</body>

この例を参照してください。

関連する問題