Search code examples
htmlcsscss-position

Why doesn't "top: 0;" put the top edge of the element at the top of the screen?


I'm trying to put a video element at the top of the screen, but using "top: 0;" doesn't put it at the very top, instead it makes a small border between the element and the edge of the page

<style>
    video {
        top: 0;
        height: 746px;
    }
</style>

    <video controls>
        <source src="wheel/wheel.mp4" type="video/mp4">
    </video>

Here's an image enter image description here


Solution

  • That's the browser default margin of body. Add html, body { margin: 0; } to avoid that.