Search code examples
csshtmlalignmentcenteringstart-page

Position a element that goes off the side?


I am trying to make the "FlowerPot" text to center-align, but it will not work. I don't know why. Maybe it is the <code> element that makes it all crazy, but I don't think that would make a difference. This is my code:

@import url(http://fonts.googleapis.com/css?family=Lobster+Two:400,400italic);
 body {
  width: 100%;
  background-color: #B10DC9;
  overflow-x: scroll;
  right: 0;
}
img {
  padding-left: 10px;
  width: 50px;
  z-index: 0;
  float: left;
}
code {
  position: absolute;
  top: 0;
  color: white;
  z-index: 0;
  float: left;
  width: 100%;
}
#introdiv {
  background-color: blue;
  text-align: center;
  width: 100%;
  padding: 0px;
  position: fixed;
  z-index: 0;
}
<div id="introdiv">
  <img src="http://cakestyle.tv/wp-content/uploads/2013/03/Flower-Pot-no-background-smaller.png"></img>
  <code style="font-family:Lobster Two; font-size:60px;">FlowerPot</code>
</div>
Please help. I don't know what I am doing wrong. DO I need to add or delete something? DO I need to change anything?

Any help would be appreciated. Thanks!


Solution

  • Add left:0 to code

    code {
      position: absolute;
      top: 0;
      color: white;
      z-index: 0;
      float: left;
      width: 100%;
      left: 0;
    }