My CSS are not fill up the bottom of the webpage - html

My CSS background-image not fulfill the bottom of my webpage, there are still some white space on the bottom of my webpage, how can I fulfill the webpage with my background image?
html, body
{
height: 100%;
}
body
{
margin: 0;
padding: 0;
background:url('semi_buffet.jpg');
background-repeat: no-repeat;
background-position:center center ;
background-size: cover;
font-family:"Times New Roman", Times, serif;
}

you could try,
object-fit:contain;
or,
object-fit:cover;

I believe your code should be working but try this:
body {
background-image: url('https://images.unsplash.com/photo-1531490744426-b6fc85d35692?
ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=d4d73c712fdb8799f077d7c2f77af115&auto=format&fit=crop&w=2467&q=80');
background-size: cover;
background-repeat: no-repeat;
}

Related

How do I make the background image still while scrolling?

I am a beginner in html and CSS I was trying to modify my old project by adding a background image and I want the image to take the size of screen while remaining still while I scroll up or down
here is my code
'''
body {
background-image: url(https://lh3.googleusercontent.com/3WHvvnFSspZKbbRkM9SgvIUMDs6efWS5vXgmSglvoHASfV4TUhIFSXd77Ic9x02zAmyrMwpg-py0YceJYVLLCK9SpU9YQU56rm-uTBKb2KoTW3dnjpgVLvhJ26koIF-VXlzao11v=w2400);
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
h1, h2 {
text-align: center;
}
.catphoto {
text-align : center;
}
'''
You can do this with the background-attachment property in CSS.
Example:
body {
background-image: url(https://picsum.photos/1080/1920);
background-size: cover;
background-repeat: no-repeat;
background-position: center;
background-attachment: fixed;
height: 300vh;
}
.cover {
background-color: aqua;
height: 50vh;
margin-top: 90vh;
padding: 20px;
}
<div class="cover">
(covering up so you can see the effect)
</div>
This fixes the position of the background to a specific place, like an element with the position of it set to fixed. It can easily be ported to your code by adding a single line in the CSS.
background-attachment: fixed;
More information about background-attachment: MDN web.dev

Full height/width background image

i have a background image and i want to use it on my website but the problemn is i cant make it full height and width in any size, help me and please, check the codes below
current code, code #1 : haft and not full
body {
background: url(http://localhost/wordpress/wp-content/uploads/2016/11/CHRISTINE-BACKGOURND.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
/* background-size: cover; */
height: auto!important;
width: 100%!important;
}
code # 2
body {
background: url(http://localhost/wordpress/wp-content/uploads/2016/11/CHRISTINE-BACKGOURND.jpg) no-repeat center center fixed;
background-color: white;
background-size: auto 100%;
background-repeat: no-repeat;
background-position: left top;
}
i cant make it full width and height :( please help
html{
width:100%,height:100%;
}
body{
background-image: url(https://i.stack.imgur.com/s0G3w.jpg);
height:100%;
width:100%;
}
<body>
</body>
Please try this
HTML
<body></body>
CSS
html{
width:100%,height:100%;
}
body{
background: url(../image.jpg) no-repeat;
background-size:cover;
height:100%;
width:100%;
}

HTML - Background size contain gives too small image

I use:
<style>
body {
background-image: url("http://www.drought-smart-plants.com/images/two-succulents-flowering-21457588.jpg");
background-repeat: no-repeat;
background-size: contain;
}
</style>
in an attempt to have a background image that always stretches to show the whole image but as I test this, the image turns to be way to small... What is the matter of this?
You need to give the body a height.
html, body {
height: 100%;
}
body {
background-image: url("http://www.drought-smart-plants.com/images/two-succulents-flowering-21457588.jpg");
background-repeat: no-repeat;
background-size: contain;
}
Or you can add a "background div".
#bkg {
position:absolute;
top: 0;
left: 0;
right: 0;
bottom:0;
background-image: url("http://www.drought-smart-plants.com/images/two-succulents-flowering-21457588.jpg");
background-repeat: no-repeat;
background-size: contain;
}
<div id="bkg"></div>
This will show the full resolution of the image by taking out background-size:contain
Results

Two Background images in CSS [duplicate]

This question already has answers here:
Can I have multiple background images using CSS?
(8 answers)
Closed 7 years ago.
I'm trying to add two backgrounds in CSS but one image to fill the entire background and the other to be aligned on the centre right of the page. Here is a section of my current StyleSheet:
body {
font-family: 'Nunito', sans-serif;
color: #384047;
background-image: url(http://footyprofit.co/wp-content/uploads/2013/02/golf-background.jpg);
background-color: #cccccc;
background-position: center;
background-repeat: no-repeat;
-webkit-background-size: cover;
}
I've tried separating the URLs with a comma and then separating the positioning by comma but this doesn't work. Any ideas?
Set the height of the parent element to 100% i.e. to html. Then used the cover value of background-size to occupy full space of the underlying image. Set right center to the 'background-position' of the first image.
html,
body {
height: 100%;
}
body {
background-image: url("http://placehold.it/300x300/333"), url("http://placehold.it/1200x1200");
background-position: right center, center center;
background-repeat: no-repeat;
background-size: auto auto, cover;
color: #384047;
font-family: "Nunito", sans-serif;
height: 100%;
}
CSS3 supports multiple background images;
body {
font-family: 'Nunito', sans-serif;
color: #384047;
background-image: url(http://footyprofit.co/wp-content/uploads/2013/02/golf-background.jpg), url(http://footyprofit.co/wp-content/uploads/2013/02/golf-background.jpg);
background-position: center center, left top;
background-repeat: no-repeat,no-repeat;
}
refer http://www.css3.info/preview/multiple-backgrounds/
You can see this tutorial : http://www.css3.info/preview/multiple-backgrounds/
example1 {
width: 500px;
height: 250px;
background-image: url(sheep.png), url(betweengrassandsky.png);
background-position: center bottom, left top;
background-repeat: no-repeat;
}
Refer this.it will help you...
body {
background-image: url(http://footyprofit.co/wp-content/uploads/2013/02/golf-background.jpg), url(http://footyprofit.co/wp-content/uploads/2013/02/golf-background.jpg);
background-position: center right, left top;
background-repeat: no-repeat, repeat;
padding: 15px;
}

Html: Background fail

I set the body to:
body { background-image: url(file:///Volumes/HDD/photomadness_remixed/css/Flavours_400812054.jp2);
background-attachment: fixed;
background-position: center;
background-size: cover;
z-index: 0;}
and it displays my background but when i set this code:
body {
z-index: -1;
background: #425b77; }
#myBody {
background-image: url(file:///Volumes/HDD/photomadness_remixed/css/Flavours_400812054.jp2);
background-attachment: fixed;
background-position: center;
background-size: cover;
z-index: 0;
}
it just would not display the background and instead just displaying the color i set on the body tag.
Any idea how to solve this?
Edit:
When i look at this code on another webpage i have it works correctly and i have written the exakt same thing.
This is my result from code at the second line:
https://www.dropbox.com/s/ioo1cnfszdzh0wu/Skärmavbild%202014-03-07%20kl.%2018.44.33.png?m=
This is the result i get from the code at line 8 and downwards:
http://www.dropbox.com/s/d8wjnwt346gzdv3/Skärmavbild%202014-03-07%20kl.%2018.44.02.png?m=
Edit:
If i add content inside the <div id="myBody"></div> then it will be blurred too because i want a blur filter on it.
try this :
body {
background: #425b77; }
#myBody {
background:url(your picture) no-repeat center center scroll;
background-size: cover;
-moz-background-size: cover;
width:50%; height:50%;
display:block;
position:fixed;
z-index:1001;
}
this is just example... change position width and height as you wish
You forgot to add Height and Width (or add the content do that div).