code html background
To set a background image in HTML, you can use the CSS background-image property. Here's an example code:
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: url("background-image.jpg");
background-repeat: no-repeat;
background-size: cover;
}
</style>
</head>
<body>
<!-- Your HTML content goes here -->
</body>
</html>
In the above code, replace "background-image.jpg" with the path to your desired image file. The background-repeat property specifies if the image should repeat horizontally or vertically. Setting it to "no-repeat" ensures that the image is not repeated. The background-size property determines how the image should be sized to fit the background. In this example, "cover" is used to make the image cover the entire background without distorting its aspect ratio.
原文地址: http://www.cveoy.top/t/topic/jcv6 著作权归作者所有。请勿转载和采集!