Home >Web Front-end >HTML Tutorial >Xiaobai is asking for advice. There is a problem with the usage of the background attribute. _html/css_WEB-ITnose
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>你好小王子!</title></head><body background="G:\我的收藏\大学各种拍摄\photo\SAM_0957.JPG"> //为什么这个图片不能显示在背景上,我的html文件存在了“G:\我的收藏\”上面<h2 dir=ltr>小王子就要诞生了!!!</h2></body></html>
1. The background specifies the picture, which is not written like this.
Go download a CSS2 manual, written by Su Chen Xiaoyu.
Specify the method in CSS: blockquote { background-image: url("image path"); }
In the file code, write e5aaf1e9883b69eb83ff1b3738546a6a
2. The image address is G drive ? Run natively?
If you are on a virtual machine, even if you write it correctly, you cannot find the picture and cannot display it.
It should be in this format. In addition, it is best not to use Chinese names, as encoding problems may cause errors.
background="../www/My Collection/Various University Shoots/photo/SAM_0957.JPG"
There is no problem with the syntax. I use my own machine and only changed the path of your code. , the background can be displayed. Check whether the photo is really there under your path, or whether the path is written incorrectly. Also, HTML comments do not use //. If you write comments like this, they will be displayed directly on the page. You should use e33ac7da527136f63c016cc68b079ba1
In other words, you can put the html and pictures directly Just put them together
6d03e65ab0d47f27fa1fa0c0fb388bfc
36cc49f0c466276486e50c850b7e4956
Put the pictures and html files together