Krishnan Krishnan - 9 days ago 6
CSS Question

Can we set style to title tag in header

Can we set style to title tag in header in html head as the following. I tried it did not work..

<title style="font-style:italic;"> My Title</title>

Answer

You can apply CSS to the <title> element, but not though the style attribute (since it is for "All elements but BASE, BASEFONT, HEAD, HTML, META, PARAM, SCRIPT, STYLE, TITLE").

I'm not aware of any browser that will apply CSS for the rendering of the title in browser tabs or title bars though.

You can, however, do something like:

head { display: block; }
title { display: block; font-size: 200%; font-weight: bold; }