2016-10-28 17 views
0

私のdivは<i>タグをラップするようにしようとしていますが、折り返しはしません。高さは常にdivの高さです。<i>タグはパディングも余白もありません。多くのことしかし、私は私のスタイルとHTMLコードを追加してい動作しませんが、私はまた、いくつかのスクリーンショットHTML divはラップしません<i>タグ

CSS

<style> 
.material-icons { 
    font-family: 'Material Icons'; 
    font-weight: normal; 
    font-style: normal; 
    font-size: inherit; 
    display: inline-block; 
    line-height: 1; 
    text-transform: none; 
    letter-spacing: normal; 
    word-wrap: normal; 
    white-space: nowrap; 
    direction: ltr; 
    -webkit-font-smoothing: antialiased; 
    text-rendering: optimizeLegibility; 
    -moz-osx-font-smoothing: grayscale; 
    font-feature-settings: 'liga'; 
} 

.button-content-ic { 
    display: inline-block; 
    margin: auto; 
} 

body, section, div { 
    -webkit-box-sizing: border-box; 
    -moz-box-sizing: border-box; 
    box-sizing: border-box; 
} 
</style> 

HTMLを追加するつもりです

<div class="button-content-ic"> 
        <i style="color: #fff;" class="material-icons">menu</i>    </div> 

スクリーンショット

タグ

enter image description here

ラッパータグ

enter image description here

事前にあなたの助けをありがとう。

答えて

1

は、たぶん、これはあなたが探しているものです:

.material-icons { 
 
    font-family: 'Material Icons'; 
 
    font-weight: normal; 
 
    font-style: normal; 
 
    font-size: inherit; 
 
    display: block!important; 
 
    line-height: 1; 
 
    text-transform: none; 
 
    letter-spacing: normal; 
 
    word-wrap: normal; 
 
    white-space: nowrap; 
 
    direction: ltr; 
 
    -webkit-font-smoothing: antialiased; 
 
    text-rendering: optimizeLegibility; 
 
    -moz-osx-font-smoothing: grayscale; 
 
    font-feature-settings: 'liga'; 
 
    color: #ffffff; 
 
} 
 
.button-content-ic { 
 
    background-color: #555555; 
 
    display: inline-block; 
 
    margin: auto; 
 
} 
 
body, 
 
section, 
 
div, 
 
i { 
 
    -webkit-box-sizing: border-box; 
 
    -moz-box-sizing: border-box; 
 
    box-sizing: border-box; 
 
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> 
 
<div class="button-content-ic"><i class="material-icons">menu</i> 
 
</div>

+0

イム申し訳ありませんが、私は投稿何の違いは何ですか? – kobbycoder

+1

コードスニペットを実行しましたか?唯一違うのは、 '材料 - アイコン'に 'display:inline-block;'を代わりに 'display:block;'を使うことです。 – nstungcom

+0

ありがとうございました。 – kobbycoder

関連する問題