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 post
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...