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

Possible CSS Enhancement #13070

Closed
jayden-arrai opened this issue Mar 14, 2014 · 2 comments
Closed

Possible CSS Enhancement #13070

jayden-arrai opened this issue Mar 14, 2014 · 2 comments

Comments

@jayden-arrai
Copy link

You can use this as an enhancement if you would like.

I had 4 images which needed to display as follows:

Medium + displayed on 1 row:

Image One Image Two Image Three Image Four
Left Aligned Centered Centered Right Aligned

Small displayed on 2 rows:

Image One / Three Image Two / Four
Right Aligned Left Aligned
Right Aligned Left Aligned

Extra Small displayed on 4 rows:

Image One - Four
Centered
Centered
Centered
Centered

So I created the following css to allow me to do that:

.text-left-xs {
  text-align: left;
}

.text-right-xs {
  text-align: right;
}

.text-center-xs {
  text-align: center;
}

@media (min-width: 768px) {
  .text-left-sm {
    text-align: left;
  }

  .text-right-sm {
    text-align: right;
  }

  .text-center-sm {
    text-align: center;
  }
}

@media (min-width: 992px) {
  .text-left-md {
    text-align: left;
  }

  .text-right-md {
    text-align: right;
  }

  .text-center-md {
    text-align: center;
  }
}

@media (min-width: 1200px) {
  .text-left-lg {
    text-align: left;
  }

  .text-right-lg {
    text-align: right;
  }

  .text-center-lg {
    text-align: center;
  }
}

The html to do what I want is:

<div class="col-md-3 col-sm-6 col-xs-12 text-left-md text-right-sm text-center-xs">
  <img />
</div>
<div class="col-md-3 col-sm-6 col-xs-12 text-center-md text-left-sm text-center-xs">
    <img />
</div>
<div class="col-md-3 col-sm-6 col-xs-12 text-center-md text-right-sm text-center-xs">
  <img  />
</div>
<div class="col-md-3 col-sm-6 col-xs-12 text-right-md text-left-sm text-center-xs">
  <img />
</div>
@cvrebert
Copy link
Collaborator

Seems somewhat niche.
FWIW, we'll probably add some mixins to make defining these sorts of classes easier; see #13014.

@mdo
Copy link
Member

mdo commented Mar 15, 2014

Closing as a dupe of #11292.

@mdo mdo closed this as completed Mar 15, 2014
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

3 participants