We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Resizing the header background image - SimplyResponsive - SB | Forum

JM Ruas
JM Ruas Jan 4 '17
Hello,


How can I resize the header background image? My upload image is distorced.

Thank you.

Darryl B Leader
Darryl B Jan 4 '17
If the image is smaller than the container size it will stretch it to fit. This would be where some distortion may be coming in. Note the background size setting of the .ow_header_pic below. This sets the height, and width to fit the container. The height of the container is set to 200px for desktop. To adjust width you could try changing the background-size to "50% 100%. This will size the image to 50% of the container width, and 100% of the container height. I'll include an example below the original css.

.ow_header_pic {
    background-image: url(images/header.jpg);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 100% 100%;
    -webkit-background-size: 100% 100%;
    -moz-background-size: 100% 100%;
    height: 200px;
    margin-bottom: 10px;
}

Example. Just paste it in your custom css for the theme in the admin panel. You can play around with it to get it where you want. You want need all of the css above since all you are changing is the size.

.ow_header_pic {
    background-size: 50% 100%;
}
The Forum post is edited by Darryl B Jan 4 '17
JM Ruas
JM Ruas Jan 5 '17
Strange... Nothing changes. My header background image comes from ow_userfiles/themes/, not from images/header.jpg and .ow_header_pic { does nothing. 
JM Ruas
JM Ruas Jan 5 '17
Are we talking about base.css?
Darryl B Leader
Darryl B Jan 5 '17
Try using this. The .ow_header_img css comes in when an image is uploaded..
.ow_header {
    text-align: center;
}
.ow_header_img {
    width: 50%;
}





JM Ruas
JM Ruas Jan 6 '17
Changes made to base.css are the same as nothing. :(
JM Ruas
JM Ruas Jan 6 '17
Well, I discover now that base.css does not do anything at all. I copy and paste base.css from other theme and nothing happens.


So, my question is: where is the file?

Darryl B Leader
Darryl B Jan 6 '17
Why aren't you just adding the css to the custom css area in the admin panel? Modifying the base css will be overwritten on updates.  Plus when you make changes on the sever you have to enable dev mode, and refresh your site to see the changes.
JM Ruas
JM Ruas Jan 7 '17
Thank you, Darryl, for the information. I didn't know that.

Please, tell me, what's the custom css folder and what's the file I can make changes.


Darryl B Leader
Darryl B Jan 7 '17
Go to admin/appearance / customization.  Click on the css tab, scroll down. You will see an empty box. Just paste this in the box, and click save at the bottom of the page. This worked on a smaller header image that I uploaded. 

.ow_header {
    text-align: center;
}
.ow_header_img {
    width: 50%;
}

Darryl B Leader
Darryl B Jan 7 '17
If this doesn't work, can you pm me your site, and a test account so I can look at it? I would need the banner loaded, and the original css. I will use inspect element to check it.
JM Ruas
JM Ruas Jan 10 '17
In my case, it works like this:

.ow_header {    text-align: center;}.ow_header_img {    width: 100%;height:100%;}


However, I would like to see the image as in the Simplicity theme: full from left to right.


Congrats for your theme and thank you for the help.

Darryl B Leader
Darryl B Jan 10 '17
Glad you got it. I tried a banner in the Simplicity theme, and it automatically stretched to full width, but the height needed to be set. This was with an uploaded image that was smaller in width than the default header image, but it was around 400px in height, so I scaled the height with the css below.

.ow_header_img {
    height: 200px;
}
Bruce Tran
Bruce Tran Apr 5 '17
I made a minor change to the header image. I like how the original Simplicity theme background fits the entire page as a background image so I updated this in the general_html.html under ow_themes. Make sure you save the original copy in case you mess up.

<div class="ow_page_wrap">
    <div class="ow_menu_fullpage">
        <div class="ow_menu_fullpage_wrap">{$main_menu}</div>
    </div>
    <div class="ow_site_panel clearfix">
    <a class="ow_logo ow_left" href="{$siteUrl}"></a>
    <div class="ow_nav_btn"></div>
    <div class="ow_console_right">
      {component class='BASE_CMP_Console'}
    </div>
  <div class="ow_menu_wrap">{component class='BASE_CMP_MainMenu' responsive=true}</div>
    </div>
    <div class="ow_header">
    <div class="ow_header_pic"></div>
    </div>
    {*if isset($imageControlValues.headerImage.src)}
    <div class="ow_header">
    <img class="ow_header_img" src="{$imageControlValues.headerImage.src}" />
    <div class="ow_header_pic"><img class="ow_header_img" src="{$themeImagesUrl}header.jpg" /></div>
    </div>
    {/if*}
    <div class="ow_page_padding">
        <div class="ow_page_container">
            <div class="ow_canvas">
                <div class="ow_page ow_bg_color clearfix">
                    {if !empty($heading)}<h1 class="ow_stdmargin {$heading_icon_class}">{$heading}</h1>{/if}
                    <div class="ow_content_wrap">
            <div class="ow_content">
              {add_content key='base.add_page_top_content'}
              {$content}
              {add_content key='base.add_page_bottom_content'}
            </div>
            <div class="ow_sidebar">
            {component class="BASE_CMP_Sidebar"}
            </div>
          </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="ow_footer">

And add this line of CSS in the Edit CSS tab.

.ow_header_pic {background-size: cover; -webkit-background-size: cover; -moz-background-size: cover; height: 250px;}
You do not have permission to reply this topic