Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2012
    Posts
    10
    Plugin Contributions
    0

    Default restricting template width below certain threshold?

    Hello, I am wondering if it is possible to set my cart width by %, but have a sort of minimum built in. In other words I would want the code to read "fill 80% of page at any resolution, BUT not below 960px".

    I love the way the % rating fills the page at higher resolutions, but at anything below 900ish pixels, my header banners get shoved off the side of the page.

    The only other solution I could think of is to write a resolution-dependent javascript that will load a short banner for lower resolutions, but having to remember to make a few different versions of each banner will quickly get annoying.


    Thanks!

    -M

  2. #2
    Join Date
    Nov 2006
    Location
    Dartmouth, NS Canada
    Posts
    2,378
    Plugin Contributions
    0

    Default Re: restricting template width below certain threshold?

    Have a Google for the CSS property min-width. It's not entirely simple to use it, and browser support is mixed, but I see it being very useful in the situation you describe.

    Rob

  3. #3
    Join Date
    Jun 2012
    Posts
    10
    Plugin Contributions
    0

    Default Re: restricting template width below certain threshold?

    Thanks! It worked like a charm!

    For anyone else wanting to try this out, I just dropped it into the following entry in my stylesheet.css

    Code:
    }
    
    #mainWrapper {
    text-align: left;
    vertical-align: top;
    width:70%; /* sets the width of the store */
    min-width:950px;
    background-color:#252525; /* gives the store a grey background */
    }

    -M

  4. #4
    Join Date
    Jan 2006
    Posts
    1,542
    Plugin Contributions
    0

    Default Re: restricting template width below certain threshold?

    Also, the Cherry Zen template has a min/max width. Never looked at how it was accomplished, but may be similar to Rob's.
    Steve
    prommart.com

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: restricting template width below certain threshold?

    It would be done just that way. min-width and max-width would both need to be after the basic width declaration so they can control in the relevant situations.
    IE6 doesn't support min-width, and IE7 support is buggy, but all modern browsers will support these fine.

  6. #6
    Join Date
    Nov 2009
    Location
    UK
    Posts
    1,090
    Plugin Contributions
    0

    Default Re: restricting template width below certain threshold?

    Have you checked if it works ok on mobile phones?

  7. #7
    Join Date
    Jun 2012
    Posts
    10
    Plugin Contributions
    0

    Default Re: restricting template width below certain threshold?

    Quote Originally Posted by dgent View Post
    Have you checked if it works ok on mobile phones?
    No, but I throttled the resolution down on a few different monitors and it seemed to work. Anything below 1200ish monitor resolution would normally result in my 950px header banner getting shoved off the side of the site, but with the minimum in place, it locked everything in place, and just forced you to scroll horizontally in the browser, which was exactly what I was going for.

    Thanks for the help, folks!

    -M

 

 

Similar Threads

  1. Tax calculation below a threshold, ot_tax.php
    By donplay in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 16
    Last Post: 19 Feb 2010, 02:51 PM
  2. Restricting access to certain pages
    By Petef in forum General Questions
    Replies: 0
    Last Post: 6 Aug 2008, 03:11 PM
  3. How to make template expandable but at least certain width?
    By tj1 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 25 Mar 2007, 04:08 AM

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