Adding clearfix to CSS


A CSS coding error is causing the links on the divs in the code below not to work except for the first one


<div class="sidebar-content-library"><img
src="" alt="Calculators"><a
<div class="sidebar-content-library"><img
src="" alt="Quizzes"><a
<div class="sidebar-content-library"><img
src="" alt="Infographics"><a
<div class="sidebar-content-library"><img
src="" alt="Slideshares"><a
<div class="sidebar-content-library"><img
src="" alt="Podcasts"><a
<div class="sidebar-content-library"><img
src="" alt="Videos"><a
href="" target="_blank">Videos</a></div>
<div class="sidebar-content-library"><img
src="" alt="Glossary"><a
href="">Debt Management Terms</a></div>


.sidebar-content-library {
      color: #013722 !important;
  list-style: none; 
  .sidebar-content-library {
    background-color: #F6F9FE;
    margin-bottom: 0.23em;
    padding: 10px 0 0 0;
    float: left;
    vertical-align: middle;
      color: #002656 !important;
      border: 1px solid #013722;
    width: 100%; }
    .sidebar-content-library div {
      float: left;
      margin-left: 20px; }
      .sidebar-content-library div a {
        color: #013722 !important;
        font-family:Arial, Helvetica, sans-serif;font-size:0.9em;font-style:normal;font-weight:bold;
        text-transform: none; }
        .sidebar-content-library div a:visited {
      color: #002656 !important;}
              .sidebar-content-library img { 
                  padding:0 6px 10px 4px;
      vertical-align: middle;

The css style applied to each div is sidebar-content-library. I think I need to clear the floats for each div.
How can I do so? I would appreciate a pointout because I’ve tried everything and I can’t get the hyperlinks on the divs after the first one to work.


You haven’t closed your first div. Try fixing your html first.

1 Like

Whoops )) thanks yes you are right…I fixed that but the links still don’t work. I wonder if I still need to apply a clear css? Thanks ))

Please EXPLAIN what “doesn’t work” means. In what way do the links not “work”. They are indeed performing the way they are coded, so I do not know what you expect to see. A make-believe screen shot might help clarify a description.

When I looked at the site earlier, I did not find “sidebar-content-library” in the HTML for the page that you linked to. That added to my uncertainty to your expectations.

Finally, run your HTML through the HTML Validator. I don’t know if fixing the errors will change the behavior of your links, or not. But invalid HTML cannot be assured to give the best cross-browser behavior. (Click the “Message Filtering” button for a summary view)

FYI: at this time, the links disappear as the width narrows. I do not see them replaced by (moved into) a hamburger menu. I’m using Firefox 52.0.5

hi sorry the code is on this page under “Information Library”

The link to the bankruptcy calculator page works but the subsequent links in the information library are not clickable

Its because you are floating everything and the background of the heading div is sitting on top of all your links. You could add clear:both to ,heading or perhaps better to unfloat those links and use another containment mechanism.



Well i redesigned the hyperlink list as long as there is no ID with the left-content name it should work, I did copy and paste everything on that web page and pasted my code over that list there appears to be small changes to some of the content for example the headings arn’t blue and the list below those links arn’t showing the arrows but are showing bullets.

I am sorry about those issues I think maybe I pasted over some of the “other” content like a class name maybe but you can try it if you know how much to replace as I can not read that page so well it’s a mess.

Other than the missing div or class I pasted over it didn’t effect anything else on the page as I can see. try it if it doesn’t work do CTRL + Z If you can,


		<h4>Information Library</h4>
		<li style="list-style-image:URL(;"><a href="#">Calculators</a></li>
		<li style="list-style-image:URL(;"><a href="#">Quizzes</a></li>
		<li style="list-style-image:URL(;"><a href="#">Infographics</a></li>
		<li style="list-style-image:URL(;"><a href="#">Slideshare</a></li>
		<li style="list-style-image:URL(;"><a href="#">Podcasts</a></li>
		<li style="list-style-image:URL(;"><a href="#">Videos</a></li>
		<li style="list-style-image:URL(;"><a href="#">Debt Management Terms</a></li>

also remember to apply the link names back there as they are currently “#”.


		#left-content ul{
		#left-content li{
			padding:10px 5px 10px 55px;
			border:#111 solid 1px;
			margin:5px 0px;
		#left-content a:link,a:visited{
			color: #568fbf;

This is not valid html.:slight_smile: All content in a ul must be inside li tags.

Alright sorry that doesn’t necessarily have to be there as there is already classes on that heading 4 on the page probably why the colour wasn’t blue.

but if the style is right the heading should align with the list.

I usually have it inside to make sure that when heading needs to be aligned with listed items than they automatically do when placing them inside the <ul> tags.

obviously extra line of styles would be required to style the header but yeah your right sorry :slight_smile:

This way does come in handy when using the checkbox hack :smiley: since only style needed to apply is checking the checkbox to unhide <li> tags and it will only work in that ul since the checkbox is a sibling so it doesn’t effect anything outside the <ul> tags.

Thanks Paul and Nathan )) I worked it out taking the float left out))) You are life savers thanks so much again.

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