174
long
8y

Backend engineer doing frontend. The eternal struggle of centering an object.

Comments
  • 4
    And the most ludicrously long js code to go with it. Also, many deprecated properties.
  • 0
    Just keep me away from the frontend 😀. Wish I could but I will leave it to the frontend pro's whenever possible.
  • 2
    My problem is getting the right colors lol
  • 5
    don't worry, centering is not as simple or intuitive as it should be, even for us front-end folks.
  • 3
    @chewbacca yeah this. why the fuck can't there just be simple css props like :
    {
    v-align: center;
    h-align: center;
    position: fixed;
    }

    or something. I mostly do dev and not design, but everytime I do so, I apply dirty af hacks with absolute positioning
  • 0
    it was and will be! forever!
  • 8
    Dude, use flexbox it's a life saver! It has pretty good browser support now. http://caniuse.com/#feat=flexbox
  • 3
    Here's a game to learn flexbox. http://www.flexboxdefense.com/ I suggest doing it on a computer.
  • 6
    Centering a span with flexbox!

    <div class="container">
    <span>
    I'm centered!
    </span>
    </div>

    .container {
    display: flex;
    justify-content: center;
    align-items: center;
    }
  • 1
    Sorry, for all the notifications, but here's an example of the above on jsfiddle. https://jsfiddle.net/w8reg9rx/
  • 3
    Currently working on a project, client said I can use the new stuff since they don't care much about browser support. Decided to go for flexbox. Never looked back.
  • 1
    This pain also applies to Android devs. The pain to make photoshopped design into codes. Considering the designer have no clue on the Android design guidelines.
  • 1
    Flexbox is your friend. I just started using it a few months ago, saves so much frustration around "wtf this shouldn't be this hard"
  • 0
    3 more ++ for a stress ball >.< !
  • 1
    @long gave you one :D
  • 1
    If you can stand to be a little more verbose. Display:table is your saviour all the way back to the dreaded IE8 and it in no way hinders your ability to create responsive content:

    http://caniuse.com/#feat=css-table

    I will totally be flexboxing it up in a couple of years however.
Add Comment