0

I am able to change the float to right and left and the effect apply but when i put in center it does not go there. I am trying to align the container to the center, Not sure when i am going wrong here. I am new to HTML and CSS and the enviorment i am running is sharepoint

.footer {
clear:both;
font-family: 'McLaren', cursive;
background-color:black;
text-align:center;
height:50px;
padding-top: 10px;
box-sizing: border-box;
}

.Book {
  float:right;
  position:relative;
  width: 20%;
  padding:0px;
  height:40px;
  text-align:center;
}
<div class="footer">
  <div class="Book" style="background-color:Grey;">
Jake
  • 23
  • 4
  • 1
    Does this answer your question? [How to horizontally center a
    ](https://stackoverflow.com/questions/114543/how-to-horizontally-center-a-div)
    – Lewis Dec 13 '19 at 14:48
  • Replace your css: .footer { clear:both; font-family: 'McLaren', cursive; background-color:black; text-align:center; height:50px; padding-top: 10px; box-sizing: border-box; } and .Book { width: 20%; background-color: grey; display: inline-block; position:relative; padding:0px; height:40px; } – AreEl Dec 13 '19 at 15:03

1 Answers1

1

Instead of

float: right;

Use

margin: auto;

Paulie_D
  • 107,962
  • 13
  • 142
  • 161