css背景标签不工作(css background tag not working)
我在css中使用background标签将图像添加到我的html文件中的body标签,而不是没有任何东西,我在这里看了所有的答案,并且已经跟着他们但无济于事。 这是我的HTML:
<!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" /> <link rel="stylesheet" type="text/css" href="main.css"> <title>Ironton Firedepartment Zombie 5k Run</title> </head> <body> </body> </html>这是我的css:
@charset "utf-8"; /*My css stuff*/ body{ background:url(images/zombie 5k TM AP stripped.png); background-repeat: no-repeat; background-position:center; }I am using the background tag in css to add an image to the body tag in my html file not nothing is apearing, i have look at all the answers here, and have followed them but to no avail. here is my html:
<!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" /> <link rel="stylesheet" type="text/css" href="main.css"> <title>Ironton Firedepartment Zombie 5k Run</title> </head> <body> </body> </html>here is my css:
@charset "utf-8"; /*My css stuff*/ body{ background:url(images/zombie 5k TM AP stripped.png); background-repeat: no-repeat; background-position:center; }最满意答案
尝试以下方法:
background:url('images/zombie 5k TM AP stripped.png');还要确保图像路径相对于调用页面是正确的。
Try the below:
background:url('images/zombie 5k TM AP stripped.png');Also ensure the image path is correct relative to the calling page.
更多推荐
发布评论