If I have a div with clip-path:polygon() can there be a child in it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If I have a div with clip-path:polygon() can there be a child in it?

8th Mar 2022, 7:51 PM
Lego in Motion
Lego in Motion - avatar
4 Answers
0
Lego in Motion We can childs elements. But it will only show content inside the clip-path while those outside will be hidden
10th Mar 2022, 11:04 AM
B.VIDYADHAR VIJJU
B.VIDYADHAR VIJJU - avatar
0
Check the below code for reference
10th Mar 2022, 11:05 AM
B.VIDYADHAR VIJJU
B.VIDYADHAR VIJJU - avatar
0
<!DOCTYPE html> <html> <style> body{ } div{ background:#000000; position:relative; height:150px; width:150px; clip-path: polygon(74% 10%, 85% 0, 81% 100%, 73% 100%, 73% 93%); } span{ position:relative; display:block; height:90px; width:900px; background:blue; } </style> <body> <div> <span style="color:#ffffff">Hello World</span> </div> </body> </html>
10th Mar 2022, 11:05 AM
B.VIDYADHAR VIJJU
B.VIDYADHAR VIJJU - avatar
0
For more information on css and any code snippets you can check the below Instagram page Id: anonymous_me_0000
10th Mar 2022, 11:06 AM
B.VIDYADHAR VIJJU
B.VIDYADHAR VIJJU - avatar