I created this border design in Photoshop and was wondering if anyone could give me some guidance with how to recreate this using css
.
I created this border design in Photoshop and was wondering if anyone could give me some guidance with how to recreate this using css
.
In addition to @Harry's answer - (which is probably the best way to approach this)...
We could also achieve this effect using the webkit
text-stroke
property by setting a thick stroke on a character such as '0'.We can fine-tune this effect by changing the stroke thickness and the font-size of the character.
Creating an effect like this is definitely possible using CSS3 but you would need more than just the border for that.
In the below sample, I have used a pseudo-element with a
radial-gradient
background to mimick the border effect shown in question. Depending on which side should have the border, you can tweak the positioning of the pseudo element to achieve the effect.The sample provided in the answer has the effect for the top border. If you want it for bottom border, you can refer to this sample. The same can be achieved for left/right border also but would need a bit more tweaking.
You can also tweak the
background-size
property to achieve smaller/larger circles in the border. You can also produce an ellipse pattern instead of a circle in the border by using the keywordellipse
instead ofcircle
in theradial-gradient
property value.Points to note:
radial-gradients
. You can use this if all your target browsers support it.radial-gradient
background could also be directly added to the maindiv
if the border is only required on the top. But positioning/achieving this effect for a bottom border wouldn't be possible with it and hence the use of a pseudo-element.border-image
property can be used to achieve the same effect using just borders but that has even lesser browswer support thanradial-gradients
(even IE 10 doesn't support it) and hence not recommended/used.radial-gradients
are not supported in IE 9 and less.Related Samples:
The method for producing a similar pattern but with triangular cuts at the bottom instead of a circle is available here - Making jagged triangle border in CSS.
The same method can be used for producing a postage stamp like border on top and bottom. A sample for that is available here. There is also a similar question and answer here which I had not come across before posting a sample in this answer.
The same method can be used to produce a border that is the inverse of the droplet border also (like in the image present below). A sample for that is available here.