Options

Help with adding CSS to HTML content block

TeetimeTeetime Registered Users Posts: 202 Major grins
edited October 5, 2015 in SmugMug Customization
I have an HTML content block on my home page with some white text in it. This content block overlays the upper portion of my background slideshow. I would like to put a slightly opaque background in the HTML content block so the text would show better when slideshow images are light. I thought I understood how to determine the widget id for the HTML block but when I put my CSS in nothing changes. Here is the CSS code I am using for the HTML block:
.sm-page-layout-row yui3-g {
  	background-color: rgba(175, 175, 175, 0.6);
}

Here is how I am determining the element ID:

1. In Chrome, I right click in the area of the HTML block and choose inspect.
2. I then move up one div at a time until the entire HTML block is selected.
3. If I move up one more div I am at the body so the selection in step 2 seems correct to me.
4. I copy the element ID from step 2 and create the code shown above.

Then I publish the change but there is no change to my home page, and when I inspect that element again in Chrome I don't see my CSS code.

Any ideas what I'm doing wrong here?

Also, my site isn't public yet, else I would put the link here.

Thanks,

Jerry
Jerry

Comments

  • Options
    AllenAllen Registered Users Posts: 10,011 Major grins
    edited October 5, 2015
    Move up about 5-8 lines and look in the class= for sm-page-widget-XXXXXXX
    This is the line you're looking for with the number you need.
    <div id="sm-page-widget-WsdpWVsr" class="sm-page-widget 
                   sm-page-widget-html [COLOR=Red]sm-page-widget-1516504[/COLOR]" data-typeid="1516504">
    

    Yours will have its own number.
    .sm-page-widget-XXXXXXX { background-color: rgba(175, 175, 175, 0.6); }
    Al - Just a volunteer here having fun
    My Website index | My Blog
  • Options
    TeetimeTeetime Registered Users Posts: 202 Major grins
    edited October 5, 2015
    Allen wrote: »
    Move up about 5-8 lines and look in the class= for sm-page-widget-XXXXXXX
    This is the line you're looking for with the number you need.
    <div id="sm-page-widget-WsdpWVsr" class="sm-page-widget 
                   sm-page-widget-html [COLOR=Red]sm-page-widget-1516504[/COLOR]" data-typeid="1516504">
    

    Yours will have its own number.
    .sm-page-widget-XXXXXXX { background-color: rgba(175, 175, 175, 0.6); }

    Allen, I followed your instructions and I get this widget ID:
    <div id="sm-page-widget-Rzxnvbvt" class="sm-page-widget sm-page-widget-html sm-page-widget-12375831" data-typeid="12375831">
    

    But I still don't see any change when I update the CSS with this widget ID. But here's the strange part - I inspect the element again and this time it has a new widget ID:
    <div id="sm-page-widget-bcLhNhKh" class="sm-page-widget sm-page-widget-html sm-page-widget-12375831" data-typeid="12375831">
    
    It seems that every time I publish this element gets a new widget ID. What am I missing here?

    Thanks,

    Jerry
    Jerry

  • Options
    pilotdavepilotdave Registered Users Posts: 785 Major grins
    edited October 5, 2015
    Teetime wrote: »
    Allen, I followed your instructions and I get this widget ID:
    <div id="sm-page-widget-Rzxnvbvt" class="sm-page-widget sm-page-widget-html sm-page-widget-12375831" data-typeid="12375831">
    

    But I still don't see any change when I update the CSS with this widget ID. But here's the strange part - I inspect the element again and this time it has a new widget ID:
    <div id="sm-page-widget-bcLhNhKh" class="sm-page-widget sm-page-widget-html sm-page-widget-12375831" data-typeid="12375831">
    
    It seems that every time I publish this element gets a new widget ID. What am I missing here?

    Thanks,

    Jerry

    sm-page-widget-12375831 seems to be the one you're looking for. It stays the same in both versions. It takes some practice to get used to deciphering the source code to make changes with css but the process is similar every time so you'll get used to it as you make more changes.

    Dave
  • Options
    TeetimeTeetime Registered Users Posts: 202 Major grins
    edited October 5, 2015
    Allen wrote: »
    Move up about 5-8 lines and look in the class= for sm-page-widget-XXXXXXX
    This is the line you're looking for with the number you need.
    <div id="sm-page-widget-WsdpWVsr" class="sm-page-widget 
                   sm-page-widget-html [COLOR=Red]sm-page-widget-1516504[/COLOR]" data-typeid="1516504">
    

    Yours will have its own number.
    .sm-page-widget-XXXXXXX { background-color: rgba(175, 175, 175, 0.6); }
    pilotdave wrote: »
    sm-page-widget-12375831 seems to be the one you're looking for. It stays the same in both versions. It takes some practice to get used to deciphering the source code to make changes with css but the process is similar every time so you'll get used to it as you make more changes.

    Dave

    Thanks Dave. I tried that but same result - no change to the HTML content block background. Maybe it is my syntax?
    h1 {
        color: white;
        text-align: center; 
    }
    h3 {
        color: white;
        text-align: center; 
    }
    
    .sm-page-widget-12375831 {  
      	background-color: rgba(175, 175, 175, 0.6);
    }
    
    Jerry

  • Options
    AllenAllen Registered Users Posts: 10,011 Major grins
    edited October 5, 2015
    When a piece of CSS doesn't work first thing to try is adding !important to it.
    See if this works. Or background: rgba... without the -color.

    .sm-page-widget-12375831 { background-color: rgba(175, 175, 175, 0.6) !important; }
    or
    .sm-page-widget-12375831 { background: rgba(175, 175, 175, 0.6); }
    Al - Just a volunteer here having fun
    My Website index | My Blog
  • Options
    TeetimeTeetime Registered Users Posts: 202 Major grins
    edited October 5, 2015
    Allen wrote: »
    When a piece of CSS doesn't work first thing to try is adding !important to it.
    See if this works. Or background: rgba... without the -color.

    .sm-page-widget-12375831 { background-color: rgba(175, 175, 175, 0.6) !important; }
    or
    .sm-page-widget-12375831 { background: rgba(175, 175, 175, 0.6); }

    Allen, I gave that a try but still no luck. I'm still not able to find the CSS I am entering anywhere in the listed cascading styles when I inspect the element.

    I appreciate everyone's effort on this, but I've given up for the moment and have an alternative design I can live with. When I get time I'll poke around more and post back here if I find out anything.

    Thanks,

    Jerry
    Jerry

  • Options
    AllenAllen Registered Users Posts: 10,011 Major grins
    edited October 5, 2015
    Where are you adding the CSS? I don't think it will work in the html box CSS tab.
    Al - Just a volunteer here having fun
    My Website index | My Blog
  • Options
    TeetimeTeetime Registered Users Posts: 202 Major grins
    edited October 5, 2015
    Allen wrote: »
    Where are you adding the CSS? I don't think it will work in the html box CSS tab.

    BINGO! I was using the HTML CSS tab which seemed like the right choice to me. I just now put it in the homepage CSS and it works as expected. Thanks for hanging with me again Allen!

    Jerry
    Jerry

  • Options
    Hikin' MikeHikin' Mike Registered Users Posts: 5,458 Major grins
    edited October 5, 2015
    Allen wrote: »
    When a piece of CSS doesn't work first thing to try is adding !important to it.
    See if this works. Or background: rgba... without the -color.

    .sm-page-widget-12375831 { background-color: rgba(175, 175, 175, 0.6) !important; }
    or
    .sm-page-widget-12375831 { background: rgba(175, 175, 175, 0.6); }

    Or add '.sm-user-ui' before the code:
    [B].sm-user-ui[/B] .sm-page-widget-12375831 {
        background: rgba( 175, 175, 175, 0.6 );
        }
    
Sign In or Register to comment.