Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexbox lines centered content #86

Open
mhulse opened this issue Aug 2, 2016 · 0 comments
Open

Flexbox lines centered content #86

mhulse opened this issue Aug 2, 2016 · 0 comments

Comments

@mhulse
Copy link
Owner

mhulse commented Aug 2, 2016

http://codepen.io/jackbrewer/pen/yOPege

.has-lines {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  text-align: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
}
.has-lines:before,
.has-lines:after {
  content: '';
  -webkit-box-flex: 1;
  -webkit-flex-grow: 1;
      -ms-flex-positive: 1;
          flex-grow: 1;
  height: 1px;
  background: #ccc;
  min-width: 20px;
  display: inline-block;
  vertical-align: middle;
}
.has-lines:before {
  margin-right: 20px;
}
.has-lines:after {
  margin-left: 20px;
}
body {
  padding: 30px;
}
.description {
  color: #777;
  max-width: 500px;
  margin: 50px auto;
}

… and:

<h1 class="has-lines">Example Title</h1>
<h1 class="has-lines">Fusce dapibus, tellus ac cursus commodo, tortor mauris</h1>
<p class="has-lines">or</p>
<p class="has-lines">Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus donec sed odio dui.</p>
<p class="has-lines">
  <button>Action here</button>
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant