margin: 0 auto; not working

Status
Not open for further replies.

St4nley

Member
Apr 13, 2013
469
76
really didnt want to post this thread i wanted to get past this problem, i even read other forums which have resolved their issue but here it is
67qcti.png

Code:
#topbanner    {
            background-color:#000000;
            width:100%;
            padding:25px;
            margin: 0 auto;
            border-radius:20px;
           
            }
 

Alam

shietttt
Jul 3, 2011
433
166
really didnt want to post this thread i wanted to get past this problem, i even read other forums which have resolved their issue but here it is
67qcti.png



Code:
#topbanner    {
            background-color:#000000;
            width:100%;
            padding:25px;
            margin: 0 auto;
            border-radius:20px;
     
            }

Code:
          margin: 0 auto;
            }

Is used to center your div, and obviously it's not gonna work if your div has a width of 100%, that means that the width is full and there is nothing to center, try making the width 900px or so.
 

St4nley

Member
Apr 13, 2013
469
76
I probally didnt explain myself, or am didnt understand you (my fault). Also i didnt even explain my wanted end result
2w1uk2s.png

i want that banner to touch the top, and the left of the page, you probally understood that. I have editied my code to fit the size of the screen so heres what my code is now
Code:
#topbanner    {
            background-color:#000000;
            width:1800px;
            padding:60px;
            margin: 0 auto 0 auto;
            border-radius:20px;
            background-image:url('clouds.png');
           
            }
i also added another 0 auto, because i believe that should put the margin left of the banner to 0, if i am correct. And still i have that little gap in between.
 

Hindi

System.out.println(" ");
Dec 30, 2012
989
193
really didnt want to post this thread i wanted to get past this problem, i even read other forums which have resolved their issue but here it is
67qcti.png

Code:
#topbanner    {
            background-color:#000000;
            width:100%;
            padding:25px;
            margin: 0 auto;
            border-radius:20px;
       
            }



Add this
{
margin-top:2cm;
}
Depending on how you want it, So basically

Code:
#topbanner    {
            background-color:#000000;
            width:100%;
            padding:25px;
            margin: 0 auto;
            border-radius:20px;
            margin-top:2cm;
            }
 

St4nley

Member
Apr 13, 2013
469
76
Add this
{
margin-top:2cm;
}
Depending on how you want it, So basically

Code:
#topbanner    {
            background-color:#000000;
            width:100%;
            padding:25px;
            margin: 0 auto;
            border-radius:20px;
            margin-top:2cm;
            }
i want it at the top of the page xD. i tried putting it at 0cm, but still theres that tiny gap inbetween.
 
Status
Not open for further replies.

Users who are viewing this thread

Top