bendc / frontend-guidelines

Some HTML, CSS and JS best practices.
8.29k stars 653 forks source link

"Use shorthand properties" #22

Closed pierrocknroll closed 9 years ago

pierrocknroll commented 9 years ago

I don't agree with this guideline.

See : http://codeguide.co/#css-shorthand https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties

benediktvaldez commented 9 years ago

+1

LeahArmstrong commented 9 years ago

This is likely going to come down to preference. Shorthand saves time in many situations where code is likely to change, and prevents the eventual accumulation of writing out each longhand property.

This goes along with the issue that this leaves inherited styles affecting the undefined properties, which can be confusing for someone else coming on to a project. The definition of all properties in shorthand (unless it makes sense to only override a single property) also prevents accidental css resets.

AndyScott77 commented 9 years ago

+1

Also the use of calc(). I know you keep cited "Standards" but this isn't fully supported and currently CR.

https://developer.mozilla.org/en-US/docs/Web/CSS/calc#Browser_compatibility

LeahArmstrong commented 9 years ago

@NET4ORCE I'd make a new ticket for this. Github issues work best when they're clear and focus on a single task.

AndyScott77 commented 9 years ago

Aye, you're right. I was feeling like a troll as I keep opening issues and they're getting closed because they will be "support"ed "eventually".

nkt commented 9 years ago

Actually :+1: Make something shortly is the task for machine. There is csso tool that compress styles from example correctly:

/* before */
div {
  transition: all 1s;
  top: 50%;
  margin-top: -10px;
  padding-top: 5px;
  padding-right: 10px;
  padding-bottom: 20px;
  padding-left: 10px;
}

/* after */
div{transition:all 1s;top:50%;margin-top:-10px;padding:5px 10px 20px}

Try it

MOZGIII commented 9 years ago

:+1: