Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the white bar in the middle of my page?

Tags:

html

css

I put a background image and I'm using a card at the middle of the page. I've a white bar that come across all the screen and I don't know how to remove it.

Here is a screenshot:

enter image description here

Here is my code

<!doctype html>
<html lang="fr">

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
    </head>

    <style type="text/css">
        @media (min-width: 768px) {
            html{
                background-image: url('https://static.lpnt.fr/images/2017/08/17/9763596lpw-9763750-article-melbourne-jpg_4493712_660x281.jpg');
                background-repeat: no-repeat;
                background-size: 100%;
            }
        }
    </style>

    <body>
        <div class="container" style="background-color: transparent;">
            <main style="background-color: transparent;">
                <div class="col-md-12" style="background-color: transparent;">
                    <div class="card mx-auto" style="width: 18rem; margin-top: 25%; background-color: red">                     
                        <div class="card-body" >                            
                            <h6 class="card-title text-center">Connexion</h6>
                            <div class="form-group">
                                <label for="exampleInputEmail1">Email</label>
                                <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
                            </div><br/>
                            <div class="text-center">
                                <a class="btn btn-primary" href="index.html">Se connecter</a>
                            </div>
                         </div>
                    </div>
                </div>
            </main>
        </div>
    </body>

</html>
like image 452
IsmaElzem Avatar asked Jan 28 '26 07:01

IsmaElzem


1 Answers

Change your background to be set to the body instead of html:

 <!doctype html>
        <html lang="fr">

            <head>
                <meta charset="utf-8">
                <meta name="viewport" content="width=device-width, initial-scale=1">
                <meta name="description" content="">
                <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
                integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
            </head>

            <style type="text/css">
                @media (min-width: 768px) {
                    body{
                        background-image: url('https://static.lpnt.fr/images/2017/08/17/9763596lpw-9763750-article-melbourne-jpg_4493712_660x281.jpg');
                        background-repeat: no-repeat;
                        background-size: 100%;
                    }
                }
            </style>

            <body>
                <div class="container" style="background-color: transparent;">
                    <main style="background-color: transparent;">
                        <div class="col-md-12" style="background-color: transparent;">
                            <div class="card mx-auto" style="width: 18rem; margin-top: 25%; background-color: red">                     
                                <div class="card-body" >                            
                                    <h6 class="card-title text-center">Connexion</h6>
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">Email</label>
                                        <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
                                    </div><br/>
                                    <div class="text-center">
                                        <a class="btn btn-primary" href="index.html">Se connecter</a>
                                    </div>
                                 </div>
                            </div>
                        </div>
                    </main>
                </div>
            </body>

        </html>
like image 196
Filip Huhta Avatar answered Jan 31 '26 06:01

Filip Huhta



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!