Reputation: 100
I am making a website and I have a background-image attribute on the body. I want the background image to have a specified width in pixels, but I can't find anything that works.
This is what I have so far:
body {
background-image: url("http://kids.nationalgeographic.com/content/dam/kids/photos/animals/Birds/H-P/mallard-male-standing.jpg.adapt.945.1.jpg");
background-size: cover;
}
<!DOCType html>
<html>
<body>
</body>
</html>
Upvotes: 0
Views: 2127
Reputation: 8668
body {
background-image: url("https://images.unsplash.com/photo-1477915737647-b5246ee6de6f?dpr=1&auto=format&fit=crop&w=1500&h=1000&q=80&cs=tinysrgb&crop=");
background-size: 500px auto;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
<!DOCType html>
<html>
<body>
</body>
</html>
Upvotes: 1