html5

Adding a placeholder to the select tag in HTML5

There is no placeholder attribute for the select tag. But there is a way around it. The following piece of code will help you solve the issue.

HTML Snippet:

<select name=”browsers” required>

<option value=”” disabled selected>Choose a Browser</option>
<option value=”chrome”>CHROME</option>
<option value=”safari”>SAFARI</option>
<option value=”opera”>OPERA</option>

</select>

CSS:

select:required:invalid {
color: #999;
}
option[value=””][disabled] {
display: none;
}
option {
color: #000;
}

Cheers,

SZ

Advertisements

Centering an Image in CSS

I have been working with some designs and I had to center an image in few pages. Previously I used to use <center> tag around the image tag and it works like a charm. But the <center> tag is deprecated in HTML5 and there is a beautiful way around to do this using CSS. Add the following code to make the image aligned exactly to the center of any web page.

img{
margin-left: auto;
margin-right: auto;
text-align: center;
}

This piece of code works like a charm.

Cheers,

SZ

No need to call HTML5, but simple HTML will do!

The World Wide Web Consortium (W3C) announced that the change of the upcoming version of HTML would not be HTML5, but simply HTML. They reasoned that a collaborative project like an HTML standard is an evolution rather than a strict milestone. When HTML5 is reasonably universal, there will be no need to call it HTML5, but simple HTML will do.