HTML:背景画像を含める-仕組み
HTMLページの背景はモノクロである必要はありません。 独自の背景画像を統合して、Webサイトをグラフィカルにより個別にすることができます。
「style」属性を使用して背景画像を含める
CSSを使用せずに、HTMLに背景画像を含めることもできます。
- HTMLページのbodyタグに属性を与えます。
- つまり、「スタイル」属性。
- 次のようになります: ""。
- この場合、ファイル「mein background.webp」はHTMLファイルと同じフォルダーにある必要があります。
廃止:「背景」属性
「背景」属性を引き続き使用できます。 しかし、それは良いスタイルではないので、いわば「非推奨」です。
- デザインがコンテンツから分離されなかった場合。
- たとえば、ここでは次のコードが使用されました: ""。
「スタイル」属性は、スタイルシートのアイデア、レイアウトとコンテンツの分離を指します。 コンテンツからデザインとレイアウトを本当に分離すれば、よりエレガントなHTMLプログラミングを実現できます。 CSSを使用してこれを行うことができます。 もう1つの実用的なヒントでは、HTMLとCSSの違いについて説明します。