Simple Landing Page Tweaks

Hello all,

I have a couple of problems with a landing page that I’ve been trying to add a few tweaks to. The page is located here.

For starters, the table at the bottom of the page (specifically the graph heights) are not responsive to the values set forth in graphheights.css. For example, at line 100 in firstratelogisticsreview.html, the ID, “1strateoverall1”, assigned to the bar graphic div, does not receive its value for height as listed in the stylesheet, graphheights.css (lines 32-34). Simple, but I’m having a lot of trouble understanding why the heights don’t change.:confused:

The next problem I’m having is the sub-headers in the content text, namely the p elements with a class of “subitalheader” at line 67, 70, etc. I want the header elements to have space that pushes them from the left side as is done with the p elements with a class of “italicheader”. A wrapping div was used to accomplish this the first time as at line 65, a div called “listwrapper” is opened. I tried adding in a second wrapping div, listwrapper2, but this is not helping to achieve the desired space/margin away from the left side.:worried:

Why did I have to use inline styles on the image at line 52? I was unable to use a class in the style sheet to get that image to clear the float and center it and undo the default border. Inline CSS is always discouraged, but I can’t figure this one out.

Anyway, that’s what I’m working on right now. Thanks, all, and have a very warm and meaningful holiday! :sunflower:


1 Like

Hi, Tyler.

Happy Holidays to you, too

The URL seems to target a non-existent page. A typo somewhere, perhaps?


1 Like

Yep, I sure did have a typo (extra 1) at the targeted link. It’s fixed, now. :tiger:

1 Like

Don’t start an ID name with a number.


Apply some padding-left to get an indent.

Why? What’s wrong with h1, h2, h3, etc…


It is nested in the .floatleft wrapper, so inherits the propery float: left from .floatleft img on line 130.

1 Like

Hi SamA74,

Your point about not starting an ID name with a number solved my first issue! :ox: :smile:

Padding-left added to the italic sub-headers worked as well to achieve the indent from the left side. I don’t know how I missed that myself, but thanks!

As for the inline styles on the centered image, yes, I know that it inherits the float from either floatLeft or floatRight. I’m wondering why I am not able to assign a new class (say, “centeredimage”) and do the CSS commands necessary in the CSS stylesheet.


1 Like

It is probably to do with “Specificity”. When there are conflicting css rules, only one can “win” so the browser must choose which one to go with. This happens through the rules of specificity, some selectors carry more weight than others. An element selector is worth less than a class, but when selectors are combined, they combine the value. So if the class selector .centeredimage is worth 10, then the combined selector .floatleft img is worth 11; that is 10 for the class + 1 for the element selector, img. So it wins over your class alone and overrides it.
There is a fuller and more accurate explanation here.

1 Like

Great post. Learned a lot.
I figured it was something to do with specificity or overlapping styles.
I added the following in lp.css for the target img.centeredimage:

img.centeredimage {
margin:0 auto!important;

It seems to be working fine.


Hi, Ty.

I would like to recommend a solution that does not require the !important modifier.

The first two rules below are the original rules that set the img properties. Notice that the rules begin with .floatRight or .floatLeft on the parent container. All you have to do to override them is copy the original selector then add the classname to img for specificity.

lp.css (line 119)

.floatRight img,
.floatLeft img {
    border: 3px inset #000;
    height: auto;
    max-width: 55%;
    width: auto;

lp.css (line 130)

.floatLeft img {
    float: left;
    margin-right: 0.5em;

So, instead of using the heavy-handed !important modifier…

lp.css (line 135)

img.centeredimage {
    border: medium none !important;  /* overkill */
    float: none !important;          /* overkill */
    margin: 0 auto !important;       /* overkill */

A more appropriate method would be to copy the original selector and add a classname to the img tag for specificity…

lp.css (line 135)

.floatRight img.centeredimage,
.floatLeft img.centeredimage {
    border: medium none;
    float: none;
    margin: 0 auto;

Because of its extreme weight, the !important modifier should be used very sparingly.
It’s hard to override a property that includes the !important modifier.



This modification works exactly as intended without using the !important modifier. I guess this will serve me well in the long run as I have continued to add design tweaks to this landing page layout. I need to continue learning how to think the way that you do. In theory, the modified selector at lp.css (line 135) makes perfect sense to me. I will improve at being able to sound these things out. :relaxed:

The page is looking ready to rock. :guitar: About to start driving traffic to it.


1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.