Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2004
    Posts
    60
    Thanks
    1
    Thanked 0 Times in 0 Posts

    inline for styles used only once vs. embedded

    When editing a layout, I think the best approach for styles used only once is to edit the style inline.

    Otherwise, I have to find the class name in the main html page, locate it in the stylesheet. Having to do that multiple times as I try to get the code to work in a different browsers and settings gets tedious real quick.

    If a style is used more than once, then it makes sense to have it be a class as it can then benefit from the edit one thing in one place and have it affect multiple things at once.



    Thoughts?

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I don't agree. The whole point of CSS is to be able to seperate style from structure. When you have inline CSS you mix it with structure. If a style is to be used only once then give the element and id and just look for it in the stylesheet.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,619
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Another consideration is that the style that you give that one element for display on the screen may not be the same style you want to provide for projection, handheld, tv, or print and definitely wont be the same style you want to apply for aural. It is much more difficult to apply media types to inline styles than it is to apply them in external stylesheets.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    New Coder
    Join Date
    Sep 2004
    Posts
    60
    Thanks
    1
    Thanked 0 Times in 0 Posts
    When only dealing with a unique style, there is no gain in separating style from structure, and having to shift between two documents to edit makes it not worth it.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •