A new design change made a new CSS problem for me.
I’m trying to override the style of a parent list in a nested list, but nothing I do works. The parent has no list-style-type but I want the nested <ul> to have square bullets. Also, the way the parent forms, line spacing is huge.
I added selectors for the <ul> at the very end of the CSS. The HTML for the nested lists starts at line 165. The cheat at line 172 using breaks is the look I’m after (with bullets). The failed <ul> is at line 187 under “your strengths.”
I’ve been researching for hours, so I appreciate a push in the right direction.
I’m not seeing a nested list on your page, what I see is a single list. With nested elements in each list-item simulating a nested list.
However, I would use nested list in order to get the square markers that your after.
There are arguments for and against <h> tags within an <li>, In my example below I will go ahead and set the h5 in the li because I would not want the <i> elements not being contained in a block level element (the li in this case). By the way, those may need to be h4 tags, I see you jumping from h3 to h5.
If you were to set the h5 outside of the ul then you would not need nested lists and you could just style each ul with square markers.
This is just a starting point and you would need to adjust your margins, paddings. You may need to set up some classes for the ul’s also so you don’t have conflicts in other areas.
First, your local css sheet, presumably it’s the one named style.css, should be the LAST css sheet in the cascade so you can override styles that preceed it in other “template” stylesheets that should not be changed.
Something in the projects.css stylesheet is overriding your !important addition to your style.css stylesheet.
If you make the following changes, the square markers will appear, but I don’t know what else might be affected.
projects.css (Line 321)
.project-details ul li {
/* display: block; /* comment out this property */
padding: 20px 25px; /* perhaps reduce horizontal padding, esp left */
border-bottom: 1px solid #eeeeee;
}
PS:
Just below that CSS on line 327, you will find this rule. Notice the invalid HTML comment after the font-size… That has to be deleted. It is corrupting the text-align part of that rule. It is not causing the list item problem, though.
.project-details ul li i {
display: block;
float: left;
width: 25px;
height: 25px;
line-height: 25px;
font-size: 16px;<!--14px-->
text-align: left;
}
Sorry about that, I see it now under “Your Threats”.
I was looking for it under “Your Strengths”, as you mentioned. You had the line 187 right though, I missed that too .
As ronpat has pointed out, the display:block overrides the default of display:list-item and removes the markers.
Following up on what I mentioned about the <h> tags being nested in a <li>. The argument against: is that the heading is not really part of a list of items. It should introduce the list of items just as any other heading introduces the content that follows it.
As far as the <i> elements that are providing the glyph/icons before the h5 tags. They can be nested in the h tags or better yet set up as background images. They would require you to rework those <i> selectors so they target the h tag instead of the li.
This is how I would mark-up the content using single ul’s and h tags, also using h4 now instead of h5.
@ronpat - thanks for the help. I didn’t ever think bout validating CSS!
@Ray.H - thanks for the help and code. I’m still having trouble because I need to get the padding/margins right but absolutely can’t get the fa icons to work. No idea how to get them in the background and didn’ttry and the only CSS I can find for them is minified (font-awesome-min.css).
In line 337 of projects css you would need to remove the left padding from the h5, commented out below. The ::before element (25px x 25px) is now on the h tag , replacing the 25px padding.
/*.project-details ul li h5, */
.project-details ul li p {
padding-left: 25px;
margin-bottom: 0;
}
I don’t know how much effort you want to invest in this. But if it were me I would change those h5’s to h4’s as I mentioned. Then you would need to edit those selectors to work with h4’s.
Are you able to track down your styles with ff inspector, or another equivalent web dev tool ?
As you mentioned earlier, you are using <br> tags on the items in the “Your Strengths” <p> tag. Those should just be list items.
Then we have <h> tags nested in list items which I don’t particularly agree with as I explained earlier. Then they jump from h3 to h5 in that project-details sidebar, that’s why I am saying to change them to h4.
So here is how I would mark up that section now with the fa icons on the h4 tags…