Skip to content
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

Pseudo selectors before or after element properties? #79

Open
SandmanPWNZ opened this issue Feb 1, 2019 · 12 comments
Open

Pseudo selectors before or after element properties? #79

SandmanPWNZ opened this issue Feb 1, 2019 · 12 comments
Labels

Comments

@SandmanPWNZ
Copy link

SandmanPWNZ commented Feb 1, 2019

this:

.column {
    &:before {
    
    }
    border: 1px solid $special-text-color-blue;
  }

or this:

.column {
    border: 1px solid $special-text-color-blue;

    &:before {

    }
  }
@SandmanPWNZ SandmanPWNZ changed the title Psuedo selectors before or after element properties? Pseudo selectors before or after element properties? Feb 1, 2019
@SandmanPWNZ
Copy link
Author

@nalabdou , have you read the title of issue? :) I'm asking which order is correct, do I add pseudo selectors for an element before element properties or after?

@ljharb
Copy link
Collaborator

ljharb commented Feb 3, 2019

I suppose as long as you choose something consistent, it’s fine?

conceptually it seems like I’d probably want “before”s to go at the top, and “after”s to go at the bottom.

@ljharb ljharb added the question label Feb 3, 2019
@GoodGuyGregory
Copy link

I always use mine after the element itself

@steve-klockow
Copy link

I think this is a question of personal patterns. I always write the Element Properties and than I go to the included elements. In this way I have a better overview about everything. But however you do it, you have to follow consistent, then it is better to read.

@jasbir91709
Copy link

jasbir91709 commented Dec 15, 2020

it doesn't matter you can choose any of the two because writing pseudo selectors after or before element will make no difference.

@Hygor
Copy link

Hygor commented Dec 15, 2020

I always use mine after the element itself

I use it like that... either for :focus & :blur etc... always at the bottom of the el { }

@JaneEye
Copy link

JaneEye commented Dec 29, 2020

test ok

@rudy0628
Copy link

rudy0628 commented Dec 9, 2021

i test for two situation, both goes will

@ghost
Copy link

ghost commented Jan 19, 2022

I usually pick the second one since it defines the pseudo-elements later after defining all the styling

@Sylar-codex
Copy link

I think this is based on personal preference, as I normally write my pseudo selectors after

@Ay989
Copy link

Ay989 commented Feb 24, 2023

from a maintainability perspective, the second code snippet is better because it places the border property first, then follows it with any pseudo-element selectors like :before. Makes the code easier to read in my opinion

@camoqq
Copy link

camoqq commented Dec 27, 2023

you can put it anywhere you'd like, the code will not be affected by doing this

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

No branches or pull requests