英文:
How can i display my background in html using css?
问题
<!DOCTYPE html>
<html>
<head>
<title>StockAdi</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<img src="logo.jpg" alt="Cafe Adi" width="175" height="175">
<h1>StockAdi</h1>
</body>
</html>
body {
background: linear-gradient(to left, #C09B30, #ffffff);
}
Your HTML and CSS code appears to be correct. If the background isn't displaying as expected, please ensure that your CSS file ("style.css") is in the correct location and that there are no typos or errors in your CSS code. Also, make sure that the HTML file is linked to the CSS file properly.
英文:
*html
//
<!DOCTYPE html>
<html>
<head>
<title> StockAdi </title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<img src="logo.jpg" alt="Cafe Adi" width="175" height="175">
<h1> StockAdi </h1>
</body>
</html>
//
*css
body{
background: linear-gradient (to left, #C09B30, #ffffff);
}
here is my code in my project, but it seems that it won't display the background that i want. What can i do?
答案1
得分: 2
It's because you had an extra space behind linear-gradient
, the syntax was invalid. Removing the space resolves your issue:
body {
background: linear-gradient(to left, #C09B30, #ffffff);
}
<!DOCTYPE html>
<html>
<body>
<img src="logo.jpg" alt="Cafe Adi" width="175" height="175">
<h1>StockAdi</h1>
</body>
</html>
英文:
It's because you had an extra space behind linear-gradient
, the syntax was invalid. Removing the space resolves your issue:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
body {
background: linear-gradient(to left, #C09B30, #ffffff);
}
<!-- language: lang-html -->
<!DOCTYPE html>
<html>
<body>
<img src="logo.jpg" alt="Cafe Adi" width="175" height="175">
<h1> StockAdi </h1>
</body>
</html>
<!-- end snippet -->
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论