Click here to Skip to main content
15,895,462 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.

 
GeneralGame Pin
Nelek26-May-18 4:14
protectorNelek26-May-18 4:14 
GeneralSplitting CSS? Pin
RandyBuchholz26-May-18 3:14
RandyBuchholz26-May-18 3:14 
GeneralRe: Splitting CSS? Pin
Sander Rossel26-May-18 3:41
professionalSander Rossel26-May-18 3:41 
GeneralRe: Splitting CSS? Pin
RandyBuchholz26-May-18 5:05
RandyBuchholz26-May-18 5:05 
GeneralRe: Splitting CSS? Pin
Sander Rossel26-May-18 22:52
professionalSander Rossel26-May-18 22:52 
GeneralRe: Splitting CSS? Pin
Marc Clifton26-May-18 6:02
mvaMarc Clifton26-May-18 6:02 
GeneralRe: Splitting CSS? Pin
RandyBuchholz26-May-18 8:55
RandyBuchholz26-May-18 8:55 
GeneralRe: Splitting CSS? Pin
Sander Rossel26-May-18 10:13
professionalSander Rossel26-May-18 10:13 
I find that LESS, SASS, or SCSS, combined with SMACCS (see my answer above), solves quite a few problems.
Let's say you have an order page and an invoice page.
Let those pages be wrapped in a div with the class order-page and invoice-page respectively (I stopped using ID's in my CSS since I read some good reasons not to that I've forgotten by now).
Now there's a table in both pages, let's say overview-table.
With SCSS you can now write a sort of "object oriented" CSS:
CSS
/* table.scss */
table {
    /* Styles for ALL tables. */
}

/* overview-table.scss (or components.scss) */
.overview-table {
    /* Styling for all tables that serve as an overview. */
}

/* order-page.scss */
.order-page {
    .overview-table {
        /* Specific styling for the order page, will never be shared with anything else! */
    }

    .something-else-order-specific {
        /* ... */
    }
}

/* invoice-page.scss */
.invoice-page {
    table {
        /* Maybe tables have something special on the invoice page... */
    }

    .overview-table {
        /* You get the point... */
    }
}
Makes for pretty decent and separated CSS files and overriding styles for one specific page becomes a lot easier.
Could be done with regular CSS, but a preprocessor makes it a lot easier and clearer.
And with a preprocessor you can use variables and mixins, which can make it even easier to change a style globally or locally.

Ultimately, you can still compile it to a single CSS file and include it on your layout.

PraiseRe: Splitting CSS? Pin
kmoorevs26-May-18 6:33
kmoorevs26-May-18 6:33 
GeneralRe: Splitting CSS? Pin
dandy7226-May-18 7:15
dandy7226-May-18 7:15 
GeneralRe: Splitting CSS? Pin
RandyBuchholz26-May-18 8:38
RandyBuchholz26-May-18 8:38 
GeneralRe: Splitting CSS? Pin
dandy7226-May-18 9:40
dandy7226-May-18 9:40 
GeneralRe: Splitting CSS? Pin
Chris Maunder26-May-18 7:47
cofounderChris Maunder26-May-18 7:47 
GeneralRe: Splitting CSS? Pin
RandyBuchholz26-May-18 8:51
RandyBuchholz26-May-18 8:51 
GeneralRe: Splitting CSS? Pin
Chris Maunder26-May-18 10:26
cofounderChris Maunder26-May-18 10:26 
GeneralRe: Splitting CSS? Pin
RandyBuchholz26-May-18 11:19
RandyBuchholz26-May-18 11:19 
GeneralRe: Splitting CSS? Pin
jgakenhe26-May-18 8:07
professionaljgakenhe26-May-18 8:07 
GeneralRe: Splitting CSS? Pin
RandyBuchholz26-May-18 8:44
RandyBuchholz26-May-18 8:44 
GeneralWhy does most C/C++ developer prefers char *c instead of char* c? Pin
.jpg26-May-18 2:20
.jpg26-May-18 2:20 
GeneralRe: Why does most C/C++ developer prefers char *c instead of char* c? Pin
User 1106097926-May-18 2:30
User 1106097926-May-18 2:30 
GeneralRe: Why does most C/C++ developer prefers char *c instead of char* c? Pin
Mike Hankey26-May-18 2:57
mveMike Hankey26-May-18 2:57 
GeneralRe: Why does most C/C++ developer prefers char *c instead of char* c? Pin
lopatir26-May-18 3:12
lopatir26-May-18 3:12 
GeneralRe: Why does most C/C++ developer prefers char *c instead of char* c? Pin
User 1106097926-May-18 3:22
User 1106097926-May-18 3:22 
GeneralRe: Why does most C/C++ developer prefers char *c instead of char* c? Pin
lopatir26-May-18 4:21
lopatir26-May-18 4:21 
GeneralRe: Why does most C/C++ developer prefers char *c instead of char* c? Pin
User 1106097926-May-18 4:27
User 1106097926-May-18 4:27 

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.