Is the order of words important in a border syntax declaration?

I’m on the ‘Borders’ lesson of ‘The Box Model’ in the CSS course, and I am just curious if the order in which we add the styling text matters. The following example is given in the lesson:

p {
  border: 3px solid coral;
}

Would it make any difference if it was declared this way instead?:

p {
  border: coral 3px solid;
}

Thanks,

Abigail

This is actually covered on the documentation for the border property. Good to get familiar with the MDN docs as they’ll be something you refer to a lot when it comes to web development. It says:

The border property may be specified using one, two, or three of the values listed below. The order of the values does not matter.

So the order doesn’t matter in terms of parsing the code. However it can matter as a form of personal preference. You can have whatever order you like, but consistency is key so that you can spot each part of the property at a glance. Generally I do stick to the size type colour order, but as long as you’re consistent I don’t think it’s super important.

1 Like