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

    Image vertical clipped on mobile.

    I'm been coding for a while on and off for many years, but this is the first time I've cared about how something renders on a mobile device.

    I have a site using the PinBoard Wordpress theme.
    the issue is an added image is clipped vertically on 320x480 displays.

    with the intent of dynamic control, the Image is dispalyed as the background image on an empty div in the header widget:

    <a href="link"><div id="headerbottom"></div></a>
    #headerbottom { background-image:url(main image);
    display: block; position: relative; margin-left: auto; margin-right: auto; clear: both; height: 244px; width:454px; z-index:999;}
    the css that's relevant is
    (there is likely redundant stuff in there now as I've been messing with it a while trying to get it working)

    @media screen and (max-width: 360px) {
    #headerbottom { background-image:url(small image) !important; display: block; position: relative; margin-left: auto; margin-right: auto; height: 168px !important; width:312px !important; z-index:999 !important; background-size:312px  168px;}
    /* making room for Menu */
    #site-title { font-weight:300; line-height:2em; display: block; margin-top:5em !important;}
    #content {margin-top:20em !important; z-index: 900;}
     } /* end max-width: 320px */
    why do I have to add !important for it do use any of these values? isn't it designed to be 'the' default for (in this case) small screens?
    the smaller image is never loading, but is re-sizing it to fit the width settings.
    The width and height are only being used when !important is used... I know background-size is being read because I revered the numbers at first and made it look really funny.

    before I added the 20em spacing the image would overlap the content area.
    both firbug and chrome inspector show nothing in the way of this display element.

    However, the lower 1/3 of the image is clipped at 320x480, and when increasing all margins to stupid numbers (like 100em) it's still clipped on mobile. yet looks fine on 100 other display tests.

    thanks in advance for any advice
    Last edited by DragonFish; 09-14-2012 at 07:15 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