[关闭]
@dudusky 2017-03-03T11:12:19.000000Z 字数 1550 阅读 506

Centering in CSS


by Dudusky


  1. graph LR;
  2. A[Hard edge]-->|Link text|B(Round edge);
  3. B-->C{Decision};
  4. C-->|One|D[Result one];
  5. C-->|Two|E[Result two];

Horizontally

1. Is it inline or linle-elemnets?

  1. * This will work for inline, inline-block,inline-table,inline-flex.
  2. - - -
  3. #### 2. Is it a block level element?
  4. * You can center a block-level element by giving it margin-left and margin-rifht of auto (ant it has a set width,otherwise it would be full width and wouldn't need centering).That's often done with shorthand like this:
  5. ```css
  6. .center-me {
  7. margin: 0 auto;
  8. }

3. Is there more than one block level element?

Vertically

1. Is it inline or linline*elements?

2. Is it blcok-level element?

Both Horizontally and Vertically

Conclusion


cover


添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注