Skip to content

add 'lighter' and 'bolder' font weight classes - #26580

Merged
mdo merged 3 commits into
twbs:v4-devfrom
browner12:patch-2
Jul 25, 2018
Merged

mdo merged 3 commits into
twbs:v4-devfrom
browner12:patch-2

Conversation

@browner12

Copy link
Copy Markdown
Contributor

these are 2 special values for font weight, that will give their content a font-weight value of 100 more or less than their inherited font-weight.

probably doesn't fully fulfill this issue, #23969, but it's a start

these are 2 special values for font weight, that will give their content a font-weight value of 100 more or less than their inherited font-weight.

probably doesn't fully fulfill this issue, twbs#23969, but it's a start
@browner12

Copy link
Copy Markdown
Contributor Author

to fix these errors I guess we'd have to update

https://github.com/twbs/bootstrap/blob/v4-dev/.stylelintrc#L21

I can't speak to the original intent behind using this rule, so I'm not sure what the appropriate answer is.

@XhmikosR

Copy link
Copy Markdown
Member

Don't bolder and lighter have numeric equivalents?

@patrickhlauke

Copy link
Copy Markdown
Member

Don't bolder and lighter have numeric equivalents?

they are relative to the inherited/current value, so no

@browner12

Copy link
Copy Markdown
Contributor Author

'bold' is equivalent to 700.

'lighter' and 'bolder' are variable, and are either 100 more or less than the value they inherit.

<div style="font-weight:600; ">
     <div style="font-weight:lighter; ">This text will be 500 weight.</div>
     <div style="font-weight:bolder; ">This text will be 700 weight.</div>
</div>

http://htmldog.com/references/css/properties/font-weight/

@XhmikosR

Copy link
Copy Markdown
Member

Yup, I figured so after commenting :)

I pushed a patch to ignore those, let me see if it's passing.

@XhmikosR

Copy link
Copy Markdown
Member

Ok, it's passing, so it's just a matter if we want this in or not. /CC @mdo @andresgalante

@XhmikosR
XhmikosR requested review from andresgalante and mdo May 25, 2018 15:07
@XhmikosR XhmikosR added feature New feature, or a change to how an existing one works css Sass sources or compiled CSS v4 v4, the frozen docs on gh-pages labels May 25, 2018
@MartijnCuppens

Copy link
Copy Markdown
Member

These utility classes might need more documentation. There will be more people who think these values have numeric equivalents.

@browner12

Copy link
Copy Markdown
Contributor Author

sounds good. if it get's accepted i'll add some docs.

@XhmikosR

XhmikosR commented Jun 7, 2018

Copy link
Copy Markdown
Member

It's already been accepted for v4.2 :)

@browner12

Copy link
Copy Markdown
Contributor Author

really? link?

@XhmikosR

XhmikosR commented Jun 7, 2018

Copy link
Copy Markdown
Member

What I mean is that the plan is to merge in 4.2. See the project associated with this PR.

Comment thread scss/utilities/_text.scss Outdated
.font-weight-bold { font-weight: $font-weight-bold !important; }
.font-italic { font-style: italic !important; }
.font-weight-light { font-weight: $font-weight-light !important; }
.font-weight-lighter { font-weight: lighter !important; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

would this need to stay uniform with the other styles and be
lighter -> $font-weight-lighter,
bolder -> $font-weight-bolder, etc?

would there need to be additions to make this work?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Those are CSS values.

@mdo mdo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Per the conversation at https://github.com/twbs/bootstrap/pull/26580/files#r193721911, let's make these variables so that folks can change them if they so choose. I know these values are inherently relative, but they could easily be remapped to 100 and 900 depending on the situation.

@browner12

Copy link
Copy Markdown
Contributor Author

sorry, but I have to disagree with that suggestion. lighter and bolder represent values relative to their parent, not fixed values.

for values like 100 and 900, shouldn't the end user just make their own as needed, like very-light or very-bold?

also, from my experience, most fonts used on websites don't even have more than 3 weights available as part of the font, so the light, normal, and bold usually cover 99% of the use cases.

@mdo

mdo commented Jul 9, 2018

Copy link
Copy Markdown
Member

I understand their intended usage, but people do whatever they want with CSS like this. 😆

My point is, if we include two new variables here, we'll be helping folks who want to have explicit options here. As soon as these become utilities and variables, it's an opportunity to move away from browser default values.

Take this example below: both are valid in their own contexts.

.font-weight-lighter { font-weight-lighter: lighter; }
.font-weight-light { font-weight-lighter: light; }

.font-weight-lighter { font-weight-lighter: 100; }
.font-weight-light { font-weight-lighter: 300; }

@browner12

Copy link
Copy Markdown
Contributor Author

alright, the variables have been added.

@mdo mdo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@mdo
mdo merged commit c8a4d9d into twbs:v4-dev Jul 25, 2018
@mdo mdo mentioned this pull request Jul 25, 2018
@browner12
browner12 deleted the patch-2 branch July 25, 2018 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

css Sass sources or compiled CSS feature New feature, or a change to how an existing one works v4 v4, the frozen docs on gh-pages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants