Create multi coloured border box using conic gradient

Hello, Folks 👋🏻

Problem: I'm struggling to add a multicolored border box around a black box content using a conic gradient.

Context: I have a paragraph tag that contains content, and I’ve styled it to transform the paragraph content into a black box. Then, I added an imaginary box behind this content box using the
::after
pseudo-class to create a multicolored border around it with a conic-gradient.

I know I can adjust the top, left, width, and height properties to position the pseudo-element behind the content box, but I don't want to control the border that way. Instead, I want to control it by padding or another method, so that whenever I increase the padding, the border width also increases.

Codepen: https://codepen.io/HritikDj/pen/XWLNjPB ( I want to create a similar effect which is there in the screenshot below)
image.png
Was this page helpful?