Join the Webstudio community

Updated 2 months ago

How to use ::after and ::before without an HTML Embed?

At a glance

The community members are discussing the inability to find a certain functionality and whether it is possible natively. One community member is working on a tooltip issue where the tooltip is hiding the first icon, preventing interaction. The discussion explores using ::before and ::after pseudo-elements to potentially fix this, but the community members conclude that these are not easily implementable in the visual programming tool. The solution suggested is to use pointer-events: none on the tooltip content to prevent it from interfering with the underlying elements. This solution is confirmed to work well by the community members.

Useful resources
I cannot find the functionnality. Did I miss something? Is it possible natively?

Thanks!
1
B
M
O
25 comments
Not possible. Why do you need it?
Rah... 😦 I'm working on tooltip and when I hover the last one, the tooltip is hiding the fist icon so I cannot interact with it.
Attachment
SCR-20241107-lwir.png
How before/after can fix this?
Here is my problem: https://www.tella.tv/video/my-video-e3z7

I thought before after could fix this...
I tryied to be inspired by this pricing page: https://coda.io/pricing (and they use before/after on the tooltip).

Don't know if it's possible but is this feature will be available on WS or not?
So you need tooltip to not catch mouse events and just hide when mouse move out of icon?
Just add pointer-events: none to tooltip content
::before and ::after behave just like regular div but do not exist in dom. So they do not fix anything alone. And I'd say they are not necessary at all caz in builder for example you will not be able to select them by clicking on canvas. But you can always add regular div and have full control from webstudio.
In the long run we need a way to support them still, but we have yet to decide how exactly
@Oleg Isonen Pseudo elements is separate topic. They should be implemented with descendent component.
ok will split that into a separate issue then
More important to support something like ::placeholder and ::details-content
technically the same for us
Yeah, but those can be hardcoded in template. before and after should be droppable
maybe something in combination with display: none would work
anyways, don't want to diverge this thread into implememntation detail
The problem is that we do not have constraints for descendent selector. You can add anything there but we do not want to support " " in selectors except for html-embed/markdown-embed.
All right @TrySound ! Thanks a lot. A already used pointer-events:none on the tooltip and on hover I made it pointer-events: auto. But it didn't work... Maybe I have to retry...
ok @TrySound it works very well! I find a way to use it. I used it badly at first. Thank for your time!
@Milan Boisgard | Uncode School, I use pseudo very frequently at work. It was jarring when I couldn't add them in Webstudio at first. I just adjusted my thinking and haven't run into a problem where an absolute positioned element hasn't worked in its place. (something to think about if you run into other use-cases for it - as I see you've got a fix for this one).
The solution with pointer-events works very fine πŸ™‚ I think the solution to add pseudo element like ::after and ::before is maybe not easy to approach with visual programming
Add a reply
Sign up and join the conversation on Discord