Comments on: ::before / ::after https://css-tricks.com Tips, Tricks, and Techniques on using Cascading Style Sheets. Fri, 30 Sep 2022 19:06:53 +0000 hourly 1 https://wordpress.org/?v=6.1.1 By: BabakFP https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1771291 Tue, 27 Apr 2021 14:28:58 +0000 http://css-tricks.com/?page_id=14158#comment-1771291 This doesn’t work

body :not(i, [class=-icon], [class*=dashicons], ::before, ::after)
font-family: $font-family !important

…but this works
body :not(i, [class=-icon], [class=dashicons]),
body:not(
)::before,
body:not(*)::after
font-family: $font-family !important

Please add it to your article because there is no article about this issue.

]]>
By: Geoff Graham https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1765527 Mon, 30 Nov 2020 15:51:35 +0000 http://css-tricks.com/?page_id=14158#comment-1765527 In reply to Carlos.

::selection

]]>
By: Carlos https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1765469 Sat, 28 Nov 2020 01:08:56 +0000 http://css-tricks.com/?page_id=14158#comment-1765469 Where’s ::selection ?

]]>
By: Chris Coyier https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1754936 Sun, 08 Mar 2020 23:18:35 +0000 http://css-tricks.com/?page_id=14158#comment-1754936 In reply to Mehmet Yıldırım.

It’s selecting the before/after pseudo-elements for ALL elements. The * means “any tag”.

]]>
By: Mehmet Yıldırım https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1754934 Sun, 08 Mar 2020 19:15:50 +0000 http://css-tricks.com/?page_id=14158#comment-1754934 *,
*:before,
*:after {

}

what does it mean ?

]]>
By: Arkar Htun https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1711526 Wed, 29 May 2019 00:11:47 +0000 http://css-tricks.com/?page_id=14158#comment-1711526 In reply to Druid of Lûhn.

Hi teacher
Can I write html tags within before and after?

]]>
By: Geoff Graham https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1652620 Thu, 11 Oct 2018 14:09:05 +0000 http://css-tricks.com/?page_id=14158#comment-1652620 In reply to kalpna123.

Yes, it does. Something like this:

a::before {
content: "";
/* other properties */
}

]]>
By: kalpna123 https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1652617 Thu, 11 Oct 2018 11:53:39 +0000 http://css-tricks.com/?page_id=14158#comment-1652617 it’s not working with tag

does it work with it?

]]>
By: Geoff Graham https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1638715 Tue, 12 Jun 2018 14:33:24 +0000 http://css-tricks.com/?page_id=14158#comment-1638715 In reply to lechant.

It is pretty confusing, but there is indeed a difference. Both ::before and ::after are called pseudo-elements because they elements in and of themselves that are distinct but directly related to the element they are attached to.

I other words, .my-class::after is very much an element like .my-class and can be styled apart from it. Chris has an oldie but goodie on how they work and some interesting things you can do with them: https://css-tricks.com/pseudo-element-roundup/

]]>
By: lechant https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1638688 Tue, 12 Jun 2018 11:23:31 +0000 http://css-tricks.com/?page_id=14158#comment-1638688 Im sorry but whats the difference between inserting the css properties into the class with the after selector (.example:after{position:absolute;}) and just inserting it into the class itself (.example{position:absolute;}) , i dont quite get the concept behind this.

]]>
By: Dave https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1613967 Sat, 23 Dec 2017 03:14:32 +0000 http://css-tricks.com/?page_id=14158#comment-1613967 In reply to Ethan Thatcher.

I think you already knew the significance of :before & :after.

]]>
By: Sarbjit Singh https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1612334 Mon, 09 Oct 2017 10:24:36 +0000 http://css-tricks.com/?page_id=14158#comment-1612334 What is the use of after before element in CSS selector?

]]>
By: JJ https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1607544 Sat, 18 Mar 2017 16:30:37 +0000 http://css-tricks.com/?page_id=14158#comment-1607544 Is it possible to use the psuedo elements within a class?

e.g.

.className li::before {

}

Thanks

]]>
By: Amitoj Singh https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1602607 Sat, 02 Jul 2016 21:37:13 +0000 http://css-tricks.com/?page_id=14158#comment-1602607 Great. Wanted to learn this “after before” thing since long but learned today only when stucked into something that needs this knowledge to proceed. Wanted to code heading decorations on two projects of mine ( lotterywale and punjabstatelottery)

I hope I will be able to code that successfully. Will ask for help here otherwise.

Thanks much,
Amitoj

]]>
By: Tobitron https://css-tricks.com/almanac/selectors/a/after-and-before/#comment-1601027 Tue, 19 Apr 2016 18:27:56 +0000 http://css-tricks.com/?page_id=14158#comment-1601027 In reply to Tobitron.

Great answer, thanks!

]]>