Jump to content

Need a help in using CSS with PHP File


AnuMohan

Recommended Posts

Need a help in using CSS with PHP File

I created a Php File to create Div's (three blue boxes) and I want to align the boxes to the centre of the browser in a same row.

My Php File is "index.php"

<!doctype html>

<head>
    <title>Test</title>
     <link rel="stylesheet" href="stylesheet.css"/>
</head>

<body>
  <div id=”Container”>
      <div id="left"></div>        
      <div id="center"></div>
      <div id="right"></div>
  </div>
</body>

</html>
    
     
My CSS File is "Stylesheet.css"

#Container{
margin: auto;
width: 1200px;
}

#left{
    background-color: blue;
    height:300px ;
    width: 300px;
    float:left;
    margin-right: 10px;
    margin-left: 10px;
}

#center{
    background-color: blue;
    height:300px ;
    width: 300px;
    float:left;
    margin-right: 10px;
    margin-left: 10px;
}

#right{
    background-color: blue;
    height:300px ;
    width: 300px;
    float:left;
    margin-right: 10px;
    margin-left: 10px;
}



I have tried to remove "float: left;", but then boxes are coming one by one in the next row, I mean not in the same row.

Please help. I want to know how to align it in the same row to the centre of the website.

Thanks in advance.
 

Link to comment
Share on other sites

So you're wanting the three boxes stacked on top of each other in the center of the page?

 

If that's what you're looking for would this work?

 

Remove the float:left; 

 

<body>

<center>

  <div id=”Container”>
      <div id="left"></div>        
      <div id="center"></div>
      <div id="right"></div>

     </div>

 </center>
</body>

 

Not 100% sure that's what you're going for.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.