Jump to content

How to float a <div> always centered on the webpage ?


Recommended Posts


I want to float a <div> so that it is always centered on the webpage . 

How can I do this ?

body {
    background-color: #ebe8e4;

#flexBox-container {
  display: flex;
  flex-wrap: nowrap;
  background-color: #fbe9d6;   
  text-align: center;
//  width: 100%;


<!DOCTYPE html>
    <meta charset="UTF-8">
    <title>Hello World!</title>
    <link rel="stylesheet" type="text/css" href="./styles.css">
  <div id="flexBox-container">
	<button id="back">Back</button>
    <button id="forward">Forward</button>
	<button id="refresh">Refresh</button>
	<button id="home">Home</button>
    <input id="url" style="width: 200px;"  type="url" value="http://vmars.us/KidSafeBrowser/"/>
    <button id="go">Go</button>
      // You can also require other files to run in this process

Thanks for your Help...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...