- This topic is empty.
-
AuthorPosts
-
April 18, 2018 at 11:02 am #269974
Big Sanch
ParticipantHi there
I didnt found any solution couse Im not sure what to search, so Im asking here now
Is it possible to integrate defined classes in other ones? As example:
(I know, its not possible like that its only an visual example)Lets assume this has been defined
/* defined styles */ .r5{ border-radius:5px; -webkit-border-radius:5px } .r10{ border-radius:10px; -webkit-border-radius:10px }
Lets assume this comes later in this stylesheet
#box{ font-size:12px; /* Lets assume I need now border radius */ /* need to write for each selector new? */ /* or is there something like: */ @import(.r5) or get(.r5) }
Is it necessary to write everythin new for each style?
Hope you can helpThanks to all
April 18, 2018 at 12:33 pm #269982Pogany
ParticipantHi Big Sanch,
#box
can also have a class, like this:<div id='box' class='r5'>
I hope this helps.
April 21, 2018 at 12:12 pm #270118Big Sanch
ParticipantHi
@ Pogany
Thx for the answer, but this doesn answer my question.
I know how to give Objects multible classes.
My question was if its possible to combine slasses with existing ones.April 21, 2018 at 12:49 pm #270119Paulie_D
MemberNo…it’s not.
Not in the terms you have stated
Selectors are specific…heck that’s why we have specificity problems.
#box
applies to all (well the one) elements with an ID ofbox
#box.r5
applies to all (well the one) elements with an ID ofbox
which also has a class ofr5
.That’s not to say there aren’t some clever things you can do with a CSS pre-processor but, in the end, they still churn out the same CSS as though you’d written it yourself.
CSS Custom Properties (or CSS Variables) might be a solution though….
April 22, 2018 at 12:24 am #270121Big Sanch
ParticipantHi
@ Paulie_D
Thx for answer. Now I understand.
I only thougt it would make work easier when somethig like this would be possible.Have a nice day
April 22, 2018 at 1:08 am #270122hanrihelen
ParticipantHi, I have exactly the problem I have not encountered, or I did not have a clear explanation at all.
April 22, 2018 at 8:46 pm #270132Mamun
ParticipantMy earlier post is not visible for some reason. I explained something. Anyway, take a look at this link. This might help a little.
April 23, 2018 at 3:39 am #270138Big Sanch
ParticipantHi
@ Mamun
Thx for answer. This with :root Paulie_D had explained too. This is not exactly what I wantetd, but its not a problem.
It was only the question if its possible or not.
root is very good for single entries. But if i define mayby:.paper { font-family:paper; font-size 16; font-weight:normal;}
.times { font-family:times; font-size 12; font-weight:bold;}I tried to find a solution not to write it again so i can use something like:
.box {
background:#000000;
.paper
}And this post and other posts Ive written tells its not possible.
But thank you for the answers
April 23, 2018 at 6:21 am #270142Mamun
ParticipantOh haha. It’s possible only on SASS or LESS.
I thought you needed the whole definition of .paper inside .box. You can’t write .paper directly inside .box but you can write:.paper, .box {
/* definition */
}Anyway, thanks a lot.
April 23, 2018 at 9:30 am #270149Big Sanch
ParticipantHi
@ Mamun
Thx for answer.
Like I looked for the moment, LESS is what I want. Thats working with that what I want to use.
Thank you very much. -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.