Forums

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

Home Forums CSS how to write single line css

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #23245
    jitendra
    Participant

    My question is how set dreamweaver for writing single line css. when it writes .via properties panel

    #49966
    mikes
    Member

    It’s good to hear that the standard seems to be that there is no standard. After looking at many examples of how people lay out their style sheets, I came to the decision long ago to use a combination of both styles depending on which is the most readable (to me) for the given tag.

    Along those lines I also add whitespace:

    Code:
    P.main { color: #000000; text-align: left; }

    opposed to:

    Code:
    P.main{color:#000000;text-align:left;}

    and indent two spaces when using the other format:

    Code:
    P.main {
    color: #000000;
    text-align: left;
    }

    I’m sure that there must be an impact on loading time but I would hope it is negligible. Imo, the time the readability saves me is well worth a minor hit in file size.

    #50147
    zero
    Member

    I think one line CSS is easier to organize. For example:

    Code:
    /*- – – – – – – – – –
    Contents
    ——————–
    AA01. Header
    AB01. Content
    ——————*/

    /*- – – – – – – – – –
    AA01. Header
    ——————*/
    #header { background-color: #000; width: 500px; }
    #header.logo { background: transparent url(logo.gif) no-repeat; float: left; }
    #header.search { float: right; padding: 5px; }
    /*- – – – – – – – – –
    AB01. Content
    ——————*/
    #content { border: 3px solid #000; width: 500px; }
    #content.sidebar { float: left; width: 100px; }

    As you can see, I also create a table of contents at the top of my CSS file, complete with unique call numbers for each section of my css so anyone can find what they want using CTRL+F. And I organize my selectors alphabetically. OCD? Maybe, but it helps me.

    #50151
    Spunkmeyer
    Member

    Wow, that’s a very handy tip. Saves going through it manually. Good work.

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