1

Currently I have everything on the left hand side of the page. But I would like to begin changing it to the middle (just horizontally). But as i'm a beginner, each time i try it doesn't turn out right. Could someone with more experience help?

html:

   <div class="iphonecontainer">
   <img class="iphone" src="untitled.jpg" align="left">
   </div>

css:

   .iphonecontainer
   {
   width:100%;
   float:left;
   margin-top:6.5%;
   }

   .iphone {
   display:block;
   width: 400px;
   margin: 0;
   padding: 0;
   }

Thanks for taking the time to help, have a good day!

ppinzon
  • 137
  • 2
  • 9

2 Answers2

1

Change margin: 0; To Margin: 0px auto; Update. Sorry yes remove the align: left.

Sundance.101
  • 404
  • 3
  • 10
  • Sorry that didn't work. Take note that in my html code, the image also has the code, align=left. I should take that out completely or change to something else? – ppinzon Aug 30 '15 at 15:17
  • Try to avoid inline styles when you can. CSS is easier to maintain and make changes. See updated answer yes remove inline rule. – Sundance.101 Aug 30 '15 at 15:19
  • This worked, thanks very much :) and thanks for the tip i'll remember that for next time – ppinzon Aug 30 '15 at 15:35
0

.iphonecontainer
   {
   width:100%;
   text-align:center;
   margin:6.5% auto;
   }