Can we set style to title tag in header

点点圈 提交于 2019-12-17 07:52:53

问题


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>

回答1:


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; }



回答2:


Nope. How the title is rendered is up to the browser.




回答3:


Unfortunately, the title is shown in the browser title bar and NOT on the page where styles get applied, so event if you set style on title tag, it wont have any effect




回答4:


You can't style the title (<title>) tag.




回答5:


Try this CSS rule:

* {display:block}

On my Chrome browser, this makes the title (and script elements!) visible on the page. Still I don't think you want that. Normally we use h1 .. h6 for titles that need to be visible on the page itself.



来源:https://stackoverflow.com/questions/6649610/can-we-set-style-to-title-tag-in-header

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!