Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How better to use?

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #40111
    nuodas159
    Participant

    Which example better?

    First Example:

    text-h {
    text-decoration: none;
    }

    text-h2 {
    text-decoration: none;
    font-size: 15px;
    }

    Second example

    text-h, text-h2 {
    text-decoration: none;
    }

    text-h2 {
    font-size: 15px;
    }

    #111153
    Paulie_D
    Member

    2nd example…if only because it has a smaller file size.

    #111155
    pmac627
    Participant

    I agree. 2nd example is better. I had always done it the first way for a long time. But as I’ve gained experience, I have come to like the second approach. If you have a lot of styles that overlap, that approach really saves not only space but makes changes a lot easier.

    #111158
    chrisburton
    Participant

    What I usually do is write my code in the way I want each class or ID styled. When I’m finished I’ll go back through and combine the similarities between classes or ID’s (show in example 2).

    #111162
    nuodas159
    Participant

    thanks for comment :)

    #111172
    Vermaas
    Participant

    @ChristopherBurton: why don’t you do that the first time?

    Ontopic: second approach

    #111174
    chrisburton
    Participant

    @Vermaas It’s just the way I work. No particular reason.

    #111231
    nuodas159
    Participant

    One more example:

    Which example better?

    First-example:

    background {
    background: url(“blabla.png”) no-repeat;
    }

    Second-example:

    background {
    background-image: url(“blabla.png”);
    background-repeat: no-repeat;
    }

    #111234
    Paulie_D
    Member

    Either works.

    I tend to use the first option for single background images.

    If I have multiple bg images then I find it somewhat easier to comma separate onto individual lines and each property.

    background {
    background-image:
    url(“blabla.png”)’
    url(“blafoor.png”);

    background-repeat:
    no-repeat,
    repeat;
    }

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘CSS’ is closed to new topics and replies.