You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What if create utility classes to workaround this? For instance, after adding indexed class to an element you would get a variable --item-index (or similar named) for each child of the element, that could be used in calc(). Implementation is trivial, but it seems to be in demand.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi folks,
There are lots of questions on Stack Overflow, how to do something in pure CSS that can't be achieved due to
calc()
limits.To give you just one example, https://stackoverflow.com/questions/38617025/using-n-inside-calc (Duplicates: https://stackoverflow.com/questions/28002684/is-there-a-way-to-use-the-n-value-in-nth-childn, https://stackoverflow.com/questions/42434460/index-of-nth-child-within-the-css-rule and so on, hundreds of votes in total).
What if create utility classes to workaround this? For instance, after adding
indexed
class to an element you would get a variable--item-index
(or similar named) for each child of the element, that could be used incalc()
. Implementation is trivial, but it seems to be in demand.Another example: https://stackoverflow.com/questions/8720931/can-css-detect-the-number-of-children-an-element-has (383 votes). After adding a class, say,
count-children
, BS could set a variable--children-number
to use withincalc()
.Sorry, if the idea doesn't belong to Bootstrap domain.
Regards,
Beta Was this translation helpful? Give feedback.
All reactions