Question? about CSS

In a declaration block of a selector, let’s say per example a textarea.
Can we have values for a property that don’t do the same function wihtin the same line?

Like per example:

textarea {
border: 3px solid (color)

Also wanted to ask about directions when it comes to a property’s directions like margin per example. do I have to put everytime left, right, top, bottom. or can I use them all within the same line?

1 Like

The border property is a shorthand declaration which allows you to specify multiple values for a border at one time (width, style, and color). So yes, you can specify the width, style, and color as per your example. That’s exactly what border was designed to do.

MDN: border

The margin property is similar. It allows you to specify top/right/bottom/left margins all at the same time (on one line).

MDN: margin

1 Like

Thank you! I always confused the top/right/bottom/left, usually I just go top/bottom/left/right and then sit there and think what did i do wrong haah!
Thanks for the explanation btw!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.