1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Help centreing html5 canvas

Discussion in 'Programming & Webmastering' started by 1nf3rn0x, Aug 4, 2013.

  1. 1nf3rn0x

    1nf3rn0x

    Joined:
    Sep 15, 2009
    Messages:
    2,038 (1.06/day)
    Thanks Received:
    361
  2. ste2425

    ste2425

    Joined:
    May 27, 2008
    Messages:
    3,465 (1.44/day)
    Thanks Received:
    399
    Location:
    Huddersfield, uk
    Don't know what youve done in the file because im at work so can't open it but here is how i performed the same thing.

    Code:
    canvas {
        padding-left: 0;
        padding-right: 0;
        padding-top:25px;
        margin-left: auto;
        margin-right: auto;
        display: block;
        width: 1050px;
    }
    Don't know if that will work or be of any help, i tried so many different methods that people posted on the net and that was the only one to work.
     
  3. kn00tcn

    kn00tcn

    Joined:
    Feb 9, 2009
    Messages:
    719 (0.33/day)
    Thanks Received:
    133
    Location:
    Toronto
    display block & margin auto + a width is how things get centered

    also it looks nicer to use shortform, the numbers will be top right bottom left

    so for example, if you wanted a top margin, centered horizontally, it would look like margin: 25px auto 0px auto;

    but in this case just do margin: auto;
     

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page