見出しに異なるフォントの太さを使用することは、意味的に正しいのだろうか。たとえば、メイン タイトルに h1 を使用しています。これがメイン タイトルであることを検索エンジンに認識させたいため、h1 を使用していますが、重いウェイトを使用したくないため、カスタムを使用したいと考えています。重み (100)。これを行うことは意味的に正しいですか?それを行うための意味的に正しい方法は他にありますか?
2 に答える
There are two types of semantics that you should be concerned about.
The first are the semantics expressed explicitly by the markup. From this perspective, an H1 is an H1 no matter what it looks like. These are the semantics that are processed by user agents for various purposes (such as giving a default presentation in a browser, weighting the relative importance of different sections of text in a search engine indexer or generating a table of contents by an outliner).
The second are the semantics that the end user infers from the rendering of the content. If you were to style a heading so it looked exactly the same as a short paragraph, would the reader still be able to understand it to be a heading? Headings don't need to be bold, but they should be styled so they can be understood to be headings by someone looking at the page.
やってもいいです。セマンティクスは、そこから解釈するものです。コードを使いやすくするために、HTML タグが用意されています。アウトプットがあなたが望むものであれば、それは問題ありません。
それがあなたのH1のスタイリング方法です!