i have a grid item (instagram button) that have instagram color gradient (using css) as the background but it doesnt fully cover the whole element because i used border-top
.
.instagram{
border-top: 1px solid rgba(156, 156, 156, 0.486);
background: -webkit-radial-gradient(30% 107%, circle, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
background: -o-radial-gradient(30% 107%, circle, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
background: -webkit-radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
}
gradient not fully covering the grid item because of border
i tried background-attachment: fixed
.
and outline
is out of question because it will give outline to all sides (only need top side). is there a way for it to make the gradient full while keeping the border-top
? or any workaround. thanks!
2
Answers
why you need top border?
if you need divider on top than that will be visible, and you need gradient in full container then just make border 0.
Pseudoelement can always solve problem like this.
position: relative;
) to allow it to accept an absolutely positioned child, which is the number 3 below.position:absolute;
so that its dimension can be freely adjusted relative to the parent, make its content blank (content: ' ';
) because we only need its border top, set its left, top, width, and height so that it attaches firmly to .instagram, and give it the border top.