Click here to Skip to main content
15,904,346 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: What are your CSS practices? Pin
Jay Bardeleben14-Aug-19 4:10
professionalJay Bardeleben14-Aug-19 4:10 
GeneralRe: What are your CSS practices? Pin
jgakenhe14-Aug-19 4:48
professionaljgakenhe14-Aug-19 4:48 
GeneralRe: What are your CSS practices? PinPopular
Chris Maunder13-Aug-19 8:15
cofounderChris Maunder13-Aug-19 8:15 
GeneralRe: What are your CSS practices? Pin
agolddog14-Aug-19 3:04
agolddog14-Aug-19 3:04 
GeneralRe: What are your CSS practices? Pin
englebart14-Aug-19 3:25
professionalenglebart14-Aug-19 3:25 
GeneralRe: What are your CSS practices? Pin
Chris Maunder14-Aug-19 3:30
cofounderChris Maunder14-Aug-19 3:30 
GeneralRe: What are your CSS practices? Pin
Jay Bardeleben14-Aug-19 4:15
professionalJay Bardeleben14-Aug-19 4:15 
GeneralRe: What are your CSS practices? Pin
Member 1409260513-Aug-19 20:59
Member 1409260513-Aug-19 20:59 
For perfect CSS in an ideal world (which seems to be what you want to talk about), I would say you should put every set of styles that occurs separately elswhere in the same project in a separate CSS class, while keeping the overall number of classes as little as possible. It can also be a good idea to draw additional separation lines between CSS classes "by subject" (page layout, object style, colors, fonts, ...) and put them not only into separate classes but into separate CSS files. This is an object-oriented CSS approach. By this, you for instance gain the possibility to have your design person maintain the colors.css for you, which means more control for her/him and less work for you.

But all this means a lot of effort, because as your project progresses, you sometimes have to split one CSS class into two or vice versa and then refactor all usages of these classes. But the more experienced you become with this approach, the less this will happen bc you will learn to think ahead to avoid the pain of refactoring. And that's when your initial effort will pay off, for yourself and for your company as well.

Cascading can be very useful in everyday practice for doing a rather loose specification in a more top-level element and be more precise in a child/descendant element. Or a second use case I can think of from my everday practice is to define a "base" style for a bunch of elements and still be able to "override" them and specify exceptions in particular cases.
GeneralRe: What are your CSS practices? Pin
loctrice14-Aug-19 1:48
professionalloctrice14-Aug-19 1:48 
GeneralOh, you ... idiot. Pin
OriginalGriff13-Aug-19 1:53
mveOriginalGriff13-Aug-19 1:53 
GeneralRe: Oh, you ... idiot. Pin
Rage13-Aug-19 1:56
professionalRage13-Aug-19 1:56 
GeneralRe: Oh, you ... idiot. Pin
musefan13-Aug-19 2:04
musefan13-Aug-19 2:04 
GeneralRe: Oh, you ... idiot. Pin
#realJSOP13-Aug-19 2:17
professional#realJSOP13-Aug-19 2:17 
GeneralRe: Oh, you ... idiot. Pin
OriginalGriff13-Aug-19 2:21
mveOriginalGriff13-Aug-19 2:21 
GeneralRe: Oh, you ... idiot. Pin
Richard Deeming13-Aug-19 4:05
mveRichard Deeming13-Aug-19 4:05 
GeneralRe: Oh, you ... idiot. Pin
Member 1126470613-Aug-19 23:12
Member 1126470613-Aug-19 23:12 
GeneralRe: Oh, you ... idiot. Pin
glennPattonWork313-Aug-19 2:23
professionalglennPattonWork313-Aug-19 2:23 
GeneralRe: Oh, you ... idiot. Pin
OriginalGriff13-Aug-19 2:34
mveOriginalGriff13-Aug-19 2:34 
GeneralRe: Oh, you ... idiot. Pin
lopatir13-Aug-19 2:43
lopatir13-Aug-19 2:43 
GeneralRe: Oh, you ... idiot. Pin
glennPattonWork313-Aug-19 2:49
professionalglennPattonWork313-Aug-19 2:49 
GeneralRe: Oh, you ... idiot. Pin
dan!sh 13-Aug-19 2:48
professional dan!sh 13-Aug-19 2:48 
GeneralRe: Oh, you ... idiot. Pin
glennPattonWork313-Aug-19 3:04
professionalglennPattonWork313-Aug-19 3:04 
GeneralRe: Oh, you ... idiot. Pin
dan!sh 13-Aug-19 22:18
professional dan!sh 13-Aug-19 22:18 
GeneralRe: Oh, you ... idiot. Pin
Sander Rossel13-Aug-19 3:58
professionalSander Rossel13-Aug-19 3:58 
GeneralRe: Oh, you ... idiot. Pin
dan!sh 13-Aug-19 22:16
professional dan!sh 13-Aug-19 22:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.