How to Style INPUT Element with CSS Using HTML5?


Placeholder Styling with CSS Using HTML5 is not actually something great that you ought to do but yeah definitely it is one among those minor details that will differentiate your website from the other websites. As a website owner you would just want to make use of the most standard styles to the placeholder such as Font Color, Font Style, Font Variant and lots more basic styles. If you wish to go to the extremes of placeholder styling in that case you possibly can create animated GIF format images from input styles.

One important thing that you got to know here is that Mozilla Firefox makes use of a completely different pattern of placeholder styling than Google Chrome and Safari Web Browsers. Apart from this a noteworthy point here is that Mozilla Firefox does not render support for Placeholder Styling with CSS Using HTML5 until its version 4.In this post on WDJ we present you interesting CSS Style Properties that you can use for INPUT placeholder styling. Let me give you an example on how you can make wonders with some distinct CSS code and style the placeholder text with the INPUT elements.

Html of The Code

1
2
3
4
5
6
7
8
9
<div>	
	<p><input type="search" placeholder="My First Name" class="firstField"/></p>
	<p><input type="search" placeholder="My Middle Name"  class="secField"/></p>
	<p><input type="search" placeholder="My Last Name"  class="thirdField"/></p>
	<p><input type="search" placeholder="My Age"  class="fourthField"/></p>
	<p><input type="search" placeholder="My Address"  class="fifthField"/></p>
	<p><input type="search" placeholder="My WorkPlace"  class="sixthField"/></p>
	<p><input type="search" placeholder="My Occupation"  class="seventhField"/></p>
</div>

Css of The Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
input:focus{box-shadow: 10px 10px 5px #888888;}
::-webkit-input-placeholder { color:#f00; }
::-moz-placeholder { color:#f00; } /* firefox 19+ */
:-ms-input-placeholder { color:#f00; } /* ie */
input:-moz-placeholder { color:#f00; }
 
/* individual: webkit */
.secField::-webkit-input-placeholder { color:#00f; }
.thirdField::-webkit-input-placeholder { color:#090; background:lightgreen; text-transform:uppercase; }
.fourthField::-webkit-input-placeholder { font-style:italic; text-decoration:overline; letter-spacing:3px; color:#999; }
.fifthField::-webkit-input-placeholder { font-style:italic;  text-decoration:underline; letter-spacing:3px; color:red; }
.sixthField::-webkit-input-placeholder { font-style:italic; letter-spacing:3px; color:#000;background:lightblue; }
.seventhField::-webkit-input-placeholder { letter-spacing:3px; color:#000;font-weight:bold; }
 
/* individual: mozilla */
.secField::-moz-placeholder { color:#00f; }
.thirdField::-moz-placeholder { color:#090; background:lightgreen; text-transform:uppercase; }
.fourthField::-moz-placeholder { font-style:italic; text-decoration:overline; letter-spacing:3px; color:#999; }
.fifthField::-moz-placeholder { font-style:italic; text-decoration:underline; letter-spacing:3px; color:red; }
.sixthField::-moz-placeholder { font-style:italic; letter-spacing:3px; color:#000;background:lightblue; }
.seventhField::-moz-placeholder {  letter-spacing:3px; color:#000;font-weight:bold; }

Check out Demo

Recently Published

»

9 Social Media and Marketing Tools Recommended for a Business

A business is set up to have a profit by delivering a product or a ...

»

Why hand-coding is always preferable over website builders

There is long debate as to why hand-coding is preferable over website ...

»

8 Reasons Your Site Should be Using Progressive Web Apps

Google has been driving at full speed since 2015 to help developers, ...

»

Tips to Handle Negative Feedback for Your Mobile App

Feedback from users for your mobile app is as essential as its ...

»

Why is Link Building So Important? Read this to understand

Getting a high ranking on search engine results is important to the ...

»

Productivity Tips for Web Developers for Efficient Time Management

The world is full of distractions. Whether you are a work-from-home, ...

»

The Importance of a Good Domain Name

The right domain name can genuinely make or break a business – ...

»

Cloud Strategy of Oracle: Working or Not?

Though Oracle considered cloud strategy as gibberish long before, it ...

»

Some Excellent SEO Tools for Boosting SEO Rankings like Never Before

You could be having a really great-looking website and the niftiest ...