Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Inline css or separate file

    Whats the best way for a contrib?

    I am working on a sidebox, the content of which needs to be centered or padded into the middle.

    1. Inline css to pad to the centre

    2. Another separate css file with one entry to do the padding

    3. Give instructions on adding the css to the main css file.
    Means editing a file so is not plug and play.

    4 Surround it with a table, one cell that is centered

    The simplest is the inline css and doesn't involve loading another css file.
    The separate css file makes it easier to alter!

    Any guidelines on the best way to do it?

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Inline css or separate file

    If this is a new sidebox, I would assign it a class, then define the style that could be copied and pasted to the stylesheet.css

    If you are refering to a sidebox already created by Zencart, you would still need to differentiate this box only as different than .sidebox, sidebox container etc.

    Unless there is a tpl file specifically for this box I can see no way to use an inline style that would apply only to this box.
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: Inline css or separate file

    Quote Originally Posted by kobra
    If this is a new sidebox, I would assign it a class, then define the style that could be copied and pasted to the stylesheet.css

    If you are refering to a sidebox already created by Zencart, you would still need to differentiate this box only as different than .sidebox, sidebox container etc.

    Unless there is a tpl file specifically for this box I can see no way to use an inline style that would apply only to this box.
    I am basically reworking a google adsense sidebox and it has its own tpl file. Also modified so it only shows on non ssl pages as if they are on an ssl page then you don't want customers distracted & leaving when they might be buying something.

    I was wondering if there is a standard to conform to. Would have prefered not to have to to edit files if possible, I like the idea of copying files to install & deleting files to remove.

  4. #4
    Join Date
    Sep 2004
    Posts
    2,420
    Plugin Contributions
    2

    Default Re: Inline css or separate file

    Quote Originally Posted by gilby
    Whats the best way for a contrib?

    I am working on a sidebox, the content of which needs to be centered or padded into the middle... Any guidelines on the best way to do it?
    In regards to 1.3x based shops you have likely already located /includes/templates/template_default/css/CSS_read_me.txt. It does not directly respond to your inquiry but may help.

    Assuming the mod is for 1.3x shops, and assuming the sidebox will display most/all of the time, and since you are only referring to one single style, adding the style to the main stylesheet is appropriate. Indeed if you expect the style will never ever require adjustment by the shop owner, you can "get by" with inline CSS or a separate style sheet. But these days I avoid inline when possible, even if "at first" it is most easy for me as developer, and you/me as shop owner. And I avoid going with a separate stylesheet, unless the style is only relevant to specific page(s) and/or is language dependent and/or the style does not need to be loaded constantly. Too many external style pages can become overly confusing.

    On the contrary the default 1.3.0.1 stylesheet.css is 11KB (and likely larger if working on a heavily customized shop). And with separate stylesheets for third party mods, it is easy to identify/remove styles when/if the mod is ever uninstalled (rather than allowing the unneeded style info linger in the main stylesheet for eternity).

    Opportunity costs in everything. So pick your poison ;)

    Thanks to the updated div/id/class code in 1.3x, and with tools like Web Developer available, shop owners can now easily experiment with their shop CSS to match their creative desires. So when possible going the main stylesheet route is the way to go and generally pays off in the end if the custom style info is well documented within the stylesheet. (ease of maintenance).

    Woody

  5. #5
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Inline css or separate file

    Gosh, Woodymon said that alot better than I did...
    Zen-Venom Get Bitten

  6. #6
    Join Date
    Sep 2004
    Posts
    2,420
    Plugin Contributions
    2

    Default Re: Inline css or separate file

    Quote Originally Posted by kobra
    Gosh, Woodymon said that alot better than I did...
    Uhhh.... Actually I didn't. I did not see that you had responded when I posted. You were much more specific whereas I was more general.

  7. #7
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: Inline css or separate file

    Thanks all for your comments.

    For better or Worse.....

    I've made my decision!

    Decided on the one line of inline css to format the sidebox, so that it would be backwardly compatible with 1.27d with no editing of css files required.

    See the result in downloads Google Adsense Sidebox

    Of course the most important part of this release is hidden (DaVinci Code Style) in the php files and the purpose of the box.

 

 

Similar Threads

  1. ModPagespeedEnableFilters - Inline small css
    By welshop.com in forum General Questions
    Replies: 0
    Last Post: 16 Apr 2012, 10:04 AM
  2. Email images and inline css to display images
    By sports guy in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 26 Mar 2012, 07:01 PM
  3. I need to separate these two lines so I can apply css.
    By member in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 2 Apr 2011, 02:19 AM
  4. CSS Flyout Menu - separate to two main categories
    By TomCZ in forum General Questions
    Replies: 0
    Last Post: 17 Mar 2007, 08:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR