WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Eleven Theme - Prevent header being distorted when browser width changes (4 posts)

  1. tdmac
    Member
    Posted 2 years ago #

    Hi Everyone,

    Would setting a min-height and a min-width prevent my header image from getting squashed whenever the browser window is resized by a visitor? Currently, my header image is squashing (and not maintaining it's original aspec ratio) whenever the browser window is changed beyond a certain threshold.

    I've tried setting minimum widths and heights, however my page layout continues to change...which I thought would be prevented by "overflow: hidden". My sidebars bump down below my posts when the browser window reaches that threshold. I'd rather those stay put.

    This is the code I entered:

    #primary {
    	float: left;
    	margin: 0 -26.4% 0 0;
    	min-width: 790px;
    	min-height: 900px;
    	overflow: hidden;
    }
  2. Digital Raindrops
    Member
    Posted 2 years ago #

    You should be using a child theme for your changes!!!

    twenty eleven is a responsive theme, it will dynamically re-size for smaller browsers!

    You will have to make it non-responsive, this is not-tested.

    #primary {
    	float: left;
    	margin: 0 -26.4% 0 0 !important;
    	min-width: 790px !important;
    	min-height: 900px !important;
    	overflow: hidden;
    }

    Also

    #content {
    	margin: 0 34% 0 7.6% !important;
    	width: 58.4% !important;
    }

    HTH

    David

  3. tdmac
    Member
    Posted 2 years ago #

    Hi David,

    Thanks so much for the responses. (I hadn't gotten your response for the other until after I posted this!) Anyway, I'm DEFINITELY using a child theme for my changes. I don't wanna mess stuff up!

    I guess I have to weigh what's more important. Being device friendly or want to stick to my header not getting distorted. I'll try your code and see what happens. Thanks!

    Might there be a way I can assign properties to the header alone, so it doesn't get squashed, while allowing everything else to reposition for smaller browsers and devices? Assuming it would be a matter of applying the same principles to that div.

    Thanks again.
    tdmac

  4. Digital Raindrops
    Member
    Posted 2 years ago #

    You would set the branding image width as fixed, untested but something like.

    #branding img {
      min-width: 960px;
    }

    Hide it on smaller devices.

    /* = Small Device Support
    -------------------------------------------------------------- */
    @media handheld, only screen and (max-width: 767px) {
    
       #branding img {
          display: none;
       }
    }

    Resize your browser window to less than 767px and the header should dissapear!

    You could build in a second mobile header image into the theme and switch between the two, hide it in the main css and show it in the mobile style so a main and a responsive mobile header.

    HTH

    David

Topic Closed

This topic has been closed to new replies.

About this Topic