0

I'm new to web design I have been trying to teach my self. For some reason I cant figure out how to get rid of the blank margins around my border with out having to change the whole pages background color. How do you do this? Margin Issues

<body>
    <div class="header">
    <div class="navigation">
        <h1>
            <img src="./Assets/Pictures/Title 1.png" 
alt="HappyCloud">
            <h2 id="search">
                <div class="search">
                    <form class="form-wrapper-2 cf">
                        <input type="text" placeholder="Search
                        ..." required>
                        <button type="submit">Search</button>
                    </form>
                </div>
             </h2>
        </h1> 
  

    
        <h2 class="tags"> 
        <a href="./Public/About Us.html"><img 
src="./Assets/Pictures/About Us 1.png" alt="About Us"></a>
        <a href="./Public/Contact Us.html"><img 
src="./Assets/Pictures/Contact Us 1.png" alt="Contact Us"></a>
    </h2>
    <br>
    

    </div>

    </div>
    <header>Custom Computers</header>
        <p>pic</p>
</body>

.header{

    position:relative;
    text-align: center;
    font-size: 20px;
    border: 2px, hidden;
    background-image: 
url(../Assets/Pictures/14ae77a7dc694035b60ec6daa3ff138f.jpg);
    background-size: cover;
    margin: 0;
    padding: 0;

}

I thought this would make the border clear the margins. I'm currently tying this in CSS. I have tried to do this in HTML as well

3
  • Your CSS rule is incomplete. Can you put the whole rule in your question: selector { declarations... }. Then to complete your question can you add the HTML code? Why? Because when your CSS is applied to the body of the page it should work. See: How to create a Minimal, Reproducible Example Commented Jan 9 at 23:53
  • Try putting margin: 0; padding: 0; on the parent, or its parent, upto and including on body. Commented Jan 10 at 0:31
  • The <body> element has a margin by default. To get rid of it, add a rule body {margin: 0} to your CSS. Commented Jan 10 at 1:00

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.