
Although text-shadow does not give good results if the shadow length is greater than 1px, you can always use a combination of text-shadow and text-stroke. Moreover, you can give blur effect with shadows which can add depth to your layout. The latter is not intended for adding outlines, but is a very good CSS hack that gives you the effect you are looking for. Although text-strokeserves the purpose by uniformly adding a smooth outline, I prefer using text-shadow due to its good browser support. ConclusionĪ slight touch of stroke can give a vibrant look to your text.

There is also a third property text-outline for adding outline to text, but currently it is not supported by any browser. On the other hand, text-shadow is supported by almost all the browsers. This is supported by Chrome, Safari, Opera and Android. Browser SupportĪs discussed earlier, the text-stroke property is supported with the -webkit-prefix by the WebKit-based browsers. You can come up with more beautiful text stroke effects by combining and altering the values of different properties like color, blur radius, stroke width and so on. These were some cool effects which you can add to your text using the above properties. Let's see an example to understand the border property.# example9 Means, it doesn't matter how thick an outline we apply to the element, the dimensions of it won't change.

This is because the default value of this CSS property is none. The border will be invisible without specifying the border-style. Without setting this property, i.e., without setting the border style, none of the other border properties will work. It defines whether the border is solid, dotted, dashed, double, groove, and one of the other possible values.

border-style: This property specifies the style of the border.It can be done by using the border-bottom-width, border-top-width, border-right-width, and border-left-width. The width of the border can be different for every individual side. It is always used with other border properties like "border-style" property to set the border first otherwise, it will not work. myInput targets your input box, and the webkit bit is for google. Notice the myInput::-webkit-input-placeholder.
We can also use the pre-defined values that are thin, medium, and thick to set the width of the border. .
Css add border to text how to#
Next → ← prev How to add a border in CSS?
