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

Allow for :first-child #23

Open
michaelmannucci opened this issue Jan 19, 2022 · 4 comments
Open

Allow for :first-child #23

michaelmannucci opened this issue Jan 19, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@michaelmannucci
Copy link

It would be great to be able to do something like:

h2:first-child' => 'mt-0',

So that the first element on the page has no top-margin, but does elsewhere. I tried it but it doesn't seem to work.

@flemming-pr
Copy link
Contributor

Oh yes this would be a good feature. But it is only necessary if you use Tailwind CSS,isn't it? In plain CSS you can define it by a selector.

@flemming-pr flemming-pr added the enhancement New feature or request label Jan 24, 2022
@michaelmannucci
Copy link
Author

Would be awesome to do it in Tailwind though ;)

@flemming-pr
Copy link
Contributor

@michaelmannucci
I think that should work fine already. I have used the pseudo classes from TailwindCSS like this.

classify.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Stylesets
    |--------------------------------------------------------------------------
    |
    | Here you can define different style collections.
    | To add a new styleset you have to add a new array like the 'blog' array.
    |
    */

    'default' => [
        'h2' => 'font-bold text-5xl first:text-red-900 last:text-sky-600',
    ],
];

grafik

Or dou I understand you wish wrong?

@michaelmannucci
Copy link
Author

I believe that would style the first H2 on the page, regardless if it's the first-child of the div... so if you wanted to remove top-margin for the first H2, it wouldn't work if the first element isn't an H2.

Also, your example doesn't seem to work for me... lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants