Skip to content

Tag: css

Can javascript make a custom @rule of css?

CSS have rules like @media, @keyframes, etc. Can such be made using javascript, e.g. @myCustomRule. If yes then how ? If no then is there any alternative to that or just to go with CSS ? Answer While you can’t create your own custom @rules, you can use the CSSOM to create supported rules and insert them…

Not quite hexagon looking border with CSS

Basically I’m trying to get this layout in CSS. I’ve somewhat working modal but I’m finding it hard to get the white box behind the text that is responsive and works for all screen sizes. Answer I have made you an example below using clip path. I personally would look to use an svg, due to b…

How to pass in a variable to the CSS grid repeat() function

I am attempting create a function which involves passing in a JS variable as a term in the CSS grid repeat() function. I do not know how to do this and cannot find google results for it, below is my attempt to estimate a possible implementation. This is for the Odin Project’s Etch-A-Sketch Project (link…