If I put a background-clip: content-box property to a div, how can I change the background-color of the content outside of the content box? It is displayed in the middle but I don't know how to change the color of the edge. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If I put a background-clip: content-box property to a div, how can I change the background-color of the content outside of the content box? It is displayed in the middle but I don't know how to change the color of the edge.

27th Jun 2016, 6:50 AM
Dominik Clemente
Dominik Clemente - avatar
5 Answers
0
Be more explicit
27th Jun 2016, 10:25 PM
Serban Cosmin
Serban Cosmin - avatar
0
Now I edited it and I tried to be as specific as I possibly can
28th Jun 2016, 6:58 AM
Dominik Clemente
Dominik Clemente - avatar
0
try this: body { background-color: #87CEFA; } div { background-clip:content-box ; background-color:red; }
28th Jun 2016, 11:30 AM
Serban Cosmin
Serban Cosmin - avatar
0
may be.. 1)you can add a padding like 20px and 1 content-box 1 padding-box ? set a margin property may help too. or 2) add a thick border and add color to like border:20px solid rgba(0,20,30,1)
23rd Jul 2016, 3:43 PM
KaChun Lau
KaChun Lau - avatar
- 1
I am in this section too. From your description, perhaps we can try two clips at the time. That is two colors? Let me try it now! after exercise, two problems: 1. can't apply two clips at the same time. 2. border-box apply clip only on the border, not outside of it.
7th Jul 2016, 5:45 AM
Alexis Cheuk Yan Lee
Alexis Cheuk Yan Lee - avatar