2016-06-16 13 views
0

HTML:変更ブートストラップフォーム入力フォント

<div class="form-group"> 
    <label for="email">Email Address:</label> 
    <input type="email" class="form-control" id="email" placeholder="[email protected]"> 
</div>    

CSS:

::-webkit-input-placeholder { 
    font-weight: bold; 
    font-size: 17px; 
} 

:-ms-input-placeholder { 
    font-weight: bold; 
    font-size: 17px; 
} 

は基本的には、 "[email protected]" のフォントが変更を取得します。しかし、一度フィールドに書き込むと、フォントは同じではなく、実際には弱い外観になります。 心に留めておいてください:私はコード作成にかなり新しいです。私のコードに誤りがあるか、コード上に構造が悪いだけで驚くことはありません。

How it looks like

How it looks like after writing

答えて

2

あなただけの瞬間にplaceholderをスタイリングしています。入力フィールドに何かを入力すると、プレースホルダは自動的にデータに置き換えられます。つまり、適切な結果を得るためにplaceholderだけでなく、.inputというコンテンツのスタイルを設定する必要があります。例えば

、次のコードを使用し

::-webkit-input-placeholder { 
    font-weight: bold; 
    font-size: 17px; 
} 

:-ms-input-placeholder { 
    font-weight: bold; 
    font-size: 17px; 
} 

input { 
    // Styling can be put here 
} 
+0

はありがとうございました! –

関連する問題