How to remove flexbox default padding/margin/pagemargin?


I’m currently starting up my senior thesis website (starting from scratch). I’m using flexbox as a structure of the html however I was wondering how to remove the default margin or page of the flexbox?


        <!--Start of Logo-->
        <div class="logo_section">People Tracking System</div>
        <!--End of Logo-->

        <!--Start of Time-->
        <div class="time_section">
            <div id = "time" ></div>
        <!--End of Time-->

        <!--Start of Login Form-->
        <div class="login_section">
            <form action="login.php" class = "container" method="POST">
                <div class="container">     
                    <label>login: </label> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input id = "inputform" type="text" placeholder="Enter Username" name="uname" required>
                    <label style="text-align:right">password: </label>&nbsp;
                    <input id = "inputform" type="password" placeholder="Enter Password" name="psw" required>
                    <input type="checkbox" checked="checked"> Remember me
                    <button type="submit" id ="submit">Login</button>
        <!--end of login form-->

CSS Code

section {
    display: -webkit-flex;
    display: flex;

    -webkit-flex-direction: row;
    flex-direction: row;

    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;

/*Logo Section*/
.logo_section {
    flex: 1 1 10%;
    order: 1;

.time_section {
    background: #143c70;
    flex: 3 1 60%;
    order: 2;
    color: white;

/*login form*/
.login_section {
    background-color: #7098cc;
    clear: none;
    flex: 1 6 15%;
    order: 3;

I hope you can help me regarding this problem. Thanks!


I think this might be happening in the jsfiddle. If it is still happening in your page you can have:

body {
    margin: 0;

Answered By – Piyush.kapoor

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published