html怎麼做網頁背景

下次还敢
發布: 2024-04-05 11:51:17
原創
1220 人瀏覽過

HTML 中設定網頁背景

HTML 中可以透過下列方法設定網頁背景:

1. 背景色(background-color)

使用background-color 屬性設定均勻背景色。

語法:

<code class="html"><body style="background-color: #cccccc;"></code>
登入後複製

2. 背景圖片(background-image)

##使用

background-image 屬性設定背景圖像。

語法:

<code class="html"><body style="background-image: url('background.jpg');"></code>
登入後複製

3. 背景重複(background-repeat)##使用

background-repeat

屬性控制背景影像的重複方式。

語法:

<code class="html"><body style="background-image: url('background.jpg'); background-repeat: repeat;"></code>
登入後複製

4. 背景位置(background-position)

##使用background-position

屬性控制背景影像的位置。

語法:

<code class="html"><body style="background-image: url('background.jpg'); background-position: left top;"></code>
登入後複製
5. 背景大小(background-size)

##使用background-size 屬性控制背景圖像的大小。

語法:

<code class="html"><body style="background-image: url('background.jpg'); background-size: 100% 100%;"></code>
登入後複製

6. 背景附件(background-attachment)

使用background-attachment 屬性控制背景圖像是否隨頁面捲動而捲動。

語法:

<code class="html"><body style="background-image: url('background.jpg'); background-attachment: fixed;"></code>
登入後複製

以上是html怎麼做網頁背景的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!