How can I remove this top space in the background image?


username

i used a simple html code to set a background image to my web page but it still shows a free space at the top of the page, i tried this code to bring the background image to life, lift it up, can you confirm me, this is The correct way or is there any problem with my existing CSS code?

margin-top:-20px

my css code

<style>
.bg-image {
  left: 0;
  right: 0;
  height: 200%;
  background-image: url("/bg.jpg");
  background-position: 0px 0px;
  position: fixed;
  background-size: cover;
  margin-top:-20px;
}

my html code:

<html>
<head> </head>
<body>
    <div class="bg-image"></div>
</body>
</html>
Susaga

The body part will call internal division, so make sure the body margins, if we set the body margin:0px; padding:0px;, it will touch the top of the browser.

try this code in your css code,

body{
    padding: 0px;
    margin: 0px;
}

Related


How can I remove this top space in the background image?

username i used a simple html code to set a background image to my web page but it still shows a free space at the top of the page, i tried this code to make the background image come to life, lift it up, can you confirm me, this is The correct way or is there

How can I remove this top space in the background image?

username i used a simple html code to set a background image to my web page but it still shows a free space at the top of the page, i tried this code to make the background image come to life, lift it up, can you confirm me, this is The correct way or is there

How can I remove this top space in the background image?

username i used a simple html code to set a background image to my web page but it still shows a free space at the top of the page, i tried this code to bring the background image to life, lift it up, can you confirm me, this is The correct way or is there any

How can I remove this top space in the background image?

username i used a simple html code to set a background image to my web page but it still shows a free space at the top of the page, i tried this code to make the background image come to life, lift it up, can you confirm me, this is The correct way or is there

How can I remove this top space in the background image?

username i used a simple html code to set a background image to my web page but it still shows a free space at the top of the page, i tried this code to make the background image come to life, lift it up, can you confirm me, this is The correct way or is there

How can I place my logo on top of the space background?

Miles Jefferson http://codepen.io/anon/pen/WbdaVB Check the codepen.io for code. Sorry, new to Stack Overflow, please don't hurt me if I'm doing it wrong. ;-; I already have my logo in my code ( http://i.imgur.com/CIwEPgT.png ), but can someone do this so tha

How can I place my logo on top of the space background?

Miles Jefferson http://codepen.io/anon/pen/WbdaVB Check the codepen.io for code. Sorry, new to Stack Overflow, please don't hurt me if I'm doing it wrong. ;-; I already have my logo in my code ( http://i.imgur.com/CIwEPgT.png ), but can someone do this so tha

How can I remove the empty space at the top of the listview?

Gilmour Garcia da Rosa I have implemented a List using react-native-elements, but it always has a blank space at the top, if I scroll down it works fine and is basically the first item below the blue title bar. Here is the code: render() { var randomFl

How can I remove the extra space from the top?

Stita <html> <head> <style type="text/css"> #wholeborder{ background-color : #f2f2f2; border-radius:5px; border:1px solid #222; resize:both; width:700px; height:320px; overflow:auto; }

How can I remove the extra space from the top?

Stita <html> <head> <style type="text/css"> #wholeborder{ background-color : #f2f2f2; border-radius:5px; border:1px solid #222; resize:both; width:700px; height:320px; overflow:auto; }

How can I remove the extra space from the top?

Stita <html> <head> <style type="text/css"> #wholeborder{ background-color : #f2f2f2; border-radius:5px; border:1px solid #222; resize:both; width:700px; height:320px; overflow:auto; }

How can I remove the space at the top of the HTML page?

Aunt Gabby I want to have some space at the top despite my CSS's margin: 0 auto; Here is the css: * { margin:0 auto; padding:0; border:0; outline:0; vertical-align: baseline; background:#eee; overflow-x: hidden; } header { width:

space on top of background image

Kamjit Singh Trying to set an image as the background of my view in SwiftUI. Using Xcode 12 Beta and iOS 14. struct ContentView: View { var body: some View { ZStack { Image("background") .resizable() .scaledToFill()

space on top of background image

Kamjit Singh Trying to set an image as the background of my view in SwiftUI. Using Xcode 12 Beta and iOS 14. struct ContentView: View { var body: some View { ZStack { Image("background") .resizable() .scaledToFill()

space on top of background image

Kamjit Singh Trying to set an image as the background of my view in SwiftUI. Using Xcode 12 Beta and iOS 14. struct ContentView: View { var body: some View { ZStack { Image("background") .resizable() .scaledToFill()

space on top of background image

Kamjit Singh Trying to set an image as the background of my view in SwiftUI. Using Xcode 12 Beta and iOS 14. struct ContentView: View { var body: some View { ZStack { Image("background") .resizable() .scaledToFill()

space on top of background image

Kamjit Singh Trying to set an image as the background of my view in SwiftUI. Using Xcode 12 Beta and iOS 14. struct ContentView: View { var body: some View { ZStack { Image("background") .resizable() .scaledToFill()

space on top of background image

Kamjit Singh Trying to set an image as the background of my view in SwiftUI. Using Xcode 12 Beta and iOS 14. struct ContentView: View { var body: some View { ZStack { Image("background") .resizable() .scaledToFill()

space on top of background image

Kamjit Singh Trying to set an image as the background of my view in SwiftUI. Using Xcode 12 Beta and iOS 14. struct ContentView: View { var body: some View { ZStack { Image("background") .resizable() .scaledToFill()

How can I remove the "a" space below the image using CSS?

Salamara I'm trying to learn the basics of CSS and I'm still having some issues. How to hide "a" space under img? I gave it a red background to make it easier to explain which part I'm talking about. Here is the problem: http://jsfiddle.net/3c48P/7/ .feedEkLis

How can I remove the "a" space below the image using CSS?

Salamara I'm trying to learn the basics of CSS and I'm still having some issues. How to hide "a" space under img? I gave it a red background to make it easier to explain which part I'm talking about. Here is the problem: http://jsfiddle.net/3c48P/7/ .feedEkLis