If you can show me an example, then I will be able to understand.
The Moderators decided to suspend a memberâs account. Later that day the Admin decided to override their decision and unsuspend the account.
Youâre going to suspend my account?
That was not a good example.
Which means, they undid the previous decision that was made.
No. And yet you do now understand what override means.
There is an example of overriding a rule which comes from your own code and which l explained to you here:
Getting initial to work at the top of the code? - #300 by TechnoBear
Before I didnât have a left position on here, it wasnât added at all.
As you can see here:
.grade ::before,
.grade ::after {
content: '';
position: absolute;
top: 0;
width: 15px;
height: 44px;
box-sizing: border-box;
}
Here I added a left position on to it, which Iâm supposed to do, right?
Iâm not so sure Iâm supposed to do this.
.grade ::before,
.grade ::after {
content: '';
position: absolute;
top: 0;
left: 29px;
width: 15px;
height: 44px;
box-sizing: border-box;
}
My 2nd question is:
These donât have top positions on them.
.grade ::before {
left: 0;
background: rgba(0, 255, 255, 0.5);
border-right: 3px solid #0059dd;
}
.grade ::after {
right: 0;
background: rgba(255, 0, 255, 0.5);
border-left: 3px solid #0059dd;
}
Does the top:0;
here carry over to the below rule-sets?
Which would mean, I wouldnât need to specify them again.
.grade ::before,
.grade ::after {
content: '';
position: absolute;
top: 0;
.grade ::before {
left: 0;
background: rgba(0, 255, 255, 0.5);
border-right: 3px solid #0059dd;
}
.grade ::after {
right: 0;
background: rgba(255, 0, 255, 0.5);
border-left: 3px solid #0059dd;
}
Wait a second, I can do this.
.grade ::before,
.grade ::after {
content: '';
position: absolute;
top: 0;
right: 0;
width: 15px;
height: 44px;
box-sizing: border-box;
}
.grade ::before {
left: 0;
background: rgba(0, 255, 255, 0.5);
border-right: 3px solid #0059dd;
}
.grade ::after {
background: rgba(255, 0, 255, 0.5);
border-left: 3px solid #0059dd;
}
As I understand it, this first rule-set here doesnât need to have both top, and left positions.
.grade ::before,
.grade ::after {
content: '';
position: absolute;
top: 0;
width: 15px;
height: 44px;
box-sizing: border-box;
}
As long as these both have positions added to them, then thatâs fine.
Am I right?
.grade ::before {
left: 0;
background: rgba(0, 255, 255, 0.5);
border-right: 3px solid #0059dd;
}
.grade ::after {
right: 0;
background: rgba(255, 0, 255, 0.5);
border-left: 3px solid #0059dd;
}
Yes, thatâs fine. They are both getting top:0;
from the grouped selector.
Then they get the left
or right
property individually as they need it.
In that situation there are NO overrides, they got what they need by grouped and individual rules.
To be technical about this.
Iâve seen this written 4 different ways,
Which way technically is how itâs supposed to be written?
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
margin: auto;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
There is no right or wrong order to write rules within a selector, it is your personal preference.
If I need all four I usually list them counterclockwise
top: 0; left: 0; bottom: 0; right: 0;
I got into that habit because if I only needed top & left thatâs how I would write them
top: 0; left: 0;
So that is usually how my flow was going anyway and then I would add bottom and right if it was neded
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.