css背景标签不工作(css background tag not working)

编程入门 行业动态 更新时间:2024-10-28 18:35:51
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.

更多推荐

本文发布于:2023-08-01 07:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1354300.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:背景   标签   工作   css   tag

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!