developers.jseidl.at
WebsiteGitHubCodePen
  • developers.jseidl.at
  • CSS
    • Bootstrap NoGutter
    • Center image
    • Hamburger Menu (Mobile Menu)
    • Table-Cell
    • mMenu Hide
  • JavaScript
    • Scroll to Element
  • Typo3
    • Cookiebanner
    • DCE Backgroundimage (Section use)
    • DCE Background Image
    • Custom Form for Indexed Search
    • Frontendlayouts for Bodyclasses
    • Frontendlayouts
  • Utils
    • Force SSL
Powered by GitBook

Copyright 2024 - jseidl.at Julian Seidl

On this page
  • CSS / SCSS
  • HTML

Was this helpful?

  1. CSS

Table-Cell

Center Elements in an Element

CSS / SCSS

.display-table {
    display: table;
    width: 100%;
    height: 100%;
    .display-table-cell {
        display: table-cell;
        width: 100%;
        height: 100%;
        vertical-align: middle;
        text-align: center;
        &.left {
            text-align: left;
        }
        &.right {
            text-align: right;
        }
        &.top {
            vertical-align: top;
        }
        &.bottom {
            vertical-align: bottom;
        }
    }
}

HTML

<div class="display-table">
        <div class="display-table-cell">
                <p>I am Centered</p>
        </div>
</div>

Last updated 1 year ago

Was this helpful?