Skip to content

Add .w-100 as width: 100% utility class #19234

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

Merged
merged 2 commits into from
Apr 6, 2016
Merged

Add .w-100 as width: 100% utility class #19234

merged 2 commits into from
Apr 6, 2016

Conversation

mdo
Copy link
Member

@mdo mdo commented Feb 17, 2016

Fixes #19221.

Any other width utilities to seriously consider?

@mdo mdo added this to the v4.0.0-alpha.3 milestone Feb 17, 2016
@@ -1,3 +1,7 @@
// Width

.w-100 { width: 100% !important; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!important should not be used

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would take a more generic identifier like .full-width instead, no?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current name parallels the naming of the other utilities and sets a pattern that additional width utilities can follow (e.g. .w-50).
Also, .w-100 indicates exactly what the class does (width: 100%, and nothing else) (albeit utilizing an abbreviation), whereas .full-width could potentially be interpreted differently (e.g. max-width: 100%, display: block) by readers lacking context.

@cvrebert
Copy link
Collaborator

This will also address #19202.

@Mevrael
Copy link

Mevrael commented Mar 9, 2016

@mdo @cvrebert

What about adding breakpoints to w-100 utlity class? In many cases element must be 100% until X breakpoint. For example buttons, dropdowns custom form inputs and other elements on mobile should be 100% while on larger screens elements must keep auto width they have by default.

Something like
.w-100
.w-100-sm-up
.w-100-sm-down
.w-100-md-up
.w-100-md-down
...

Please note that I am against adding xs to 1st element same as in discussion about .hidden because:

  1. it's not obvious;
  2. if developer will made custom breakpoints or add a breakpoint before xs then utilty class wont cover all breakpoints, i.e. if currently in whole codebase you use .hidden-xs-up and after some time added new breakpoint xxs, your hidden-xs-up wont work on new breakpoint, it wont work as expected "hidden always"

@cvrebert
Copy link
Collaborator

cvrebert commented Apr 6, 2016

Added documentation in a follow-up commit.

@cvrebert
Copy link
Collaborator

cvrebert commented Apr 6, 2016

Merging since adding .w-100 will resolve multiple issues.
We can always add further width utilities (or bikeshed the naming more) later.
@Mevrael Feel free to open a new issue for your breakpoints suggestion.
/fyi @mdo

@cvrebert cvrebert merged commit 44c09cc into v4-dev Apr 6, 2016
@cvrebert cvrebert deleted the v4-w100 branch April 6, 2016 22:19
@mdo mdo mentioned this pull request Apr 6, 2016
@mdo
Copy link
Member Author

mdo commented Apr 7, 2016

Thanks @cvrebert!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants