I am having trouble with making my dropdown menu responsive so it goes from a horizontal menu on the desktop / tablet to a stacked vertical dropdown menu for the iphone / android.
The menu is at bankruptcycanada.com/menu4.html and the markup is
<div id='cssmenu'>
<ul>
<li><a href='/'>Home</a></li>
<li><a href='#'>Contact a Trustee</a>
</li>
<li class='has-sub'><a href='#'>FAQ</a>
<ul>
<li><a href='/question1.htm'>Frequently Asked Questions</a></li>
<li><a href='/Credit-Counsellors.htm'>Credit Counsellors</a></li>
<li><a href='/how-bankruptcy-works.htm'>How Bankruptcy Works</a></li>
<li><a href='/BankruptcySteps.ppt.mht.html'>Steps in a Bankruptcy</a></li>
<li><a href='/personal1.htm'>Personal Bankruptcy</a></li>
<li><a href='/business1.htm'>Business Bankruptcy</a></li>
<li><a href='/conduct-before-filing-bankruptcy.htm'>Conduct Before Going Bankrupt</a></li>
<li><a href='/meeting-the-trustee.htm'>Meeting the Trustee</a></li>
<li><a href='/Bankruptcy-Myths.htm'>Bankruptcy Myths</a></li>
<li class='last'><a href='/blog.htm'>Blog</a></li>
</ul>
</li>
<li><a href='/BankruptcyTermPredictor.php'>Bankruptcy Cost</a></li>
<li><a href='/ask-a-trustee/'>Ask a Trustee</a></li>
<li class='has-sub'><a href='#'>Proposals</a>
<ul>
<li><a href='/consumer-proposals.htm'>Consumer Proposals - Avoid Bankruptcy</a></li>
<li><a href='/Bankruptcy-vs-Consumer-Proposals.htm'>Bankruptcy vs. Consumer Proposal</a></li>
<li class='last'><a href='/ConsumerProposalSteps.html'>Steps in a Consumer Proposal</a></li>
</ul>
</li>
<li class='has-sub'><a href='#'>Exemptions</a>
<ul>
<li class='last'><a href='/bankruptcyexemptions.htm'>Find Out What You KEEP</a></li>
</ul>
<li class='has-sub'><a href='#'>After Bankruptcy</a>
<ul>
<li class='last'><a href='/rebuildcredit1.htm'>Credit After Bankruptcy</a></li>
<li class='last'><a href='/After-Bankruptcy-Lenders.htm'>After Bankruptcy Lenders</a></li>
</ul>
</li>
<li><a href='/francais.htm'>Francais</a></li>
</ul>
</div>
I have separate stylesheets desktop.css / tablet.css / iphone.css / phone.css.
The styles I wrote for the desktop is:
#cssmenu
#cssmenu,
#cssmenu ul,
#cssmenu li,
#cssmenu a {
border: none;
margin: 0;
padding: 0;
}
#cssmenu {
height: 37px;
display: block;
padding: 0;
margin: 2px 0;
border: 1px solid;
border-radius: 5px;
width: auto;
}
#cssmenu > ul {
list-style: inside none;
padding: 0;
margin: 0;
}
#cssmenu > ul > li {
list-style: inside none;
padding: 0;
margin: 0;
float: left;
display: block;
position: relative;
}
#cssmenu > ul > li > a {
outline: none;
display: block;
position: relative;
padding: 8px 16px;
text-align: center;
text-decoration: none;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
font-weight: bold;
font-size: 13px;
font-family: Arial, Helvetica, sans-serif;
}
#cssmenu > ul > li:first-child > a {
border-radius: 5px 0 0 5px;
}
#cssmenu > ul > li > a:after {
content: '';
position: absolute;
border-right: 1px solid;
top: -1px;
bottom: -1px;
right: -2px;
z-index: 99;
}
#cssmenu ul li.has-sub:hover > a:after {
top: 0;
bottom: 0;
}
#cssmenu > ul > li.has-sub > a:before {
content: '';
position: absolute;
top: 18px;
right: 4px;
border: 5px solid transparent;
border-top: 5px solid #FFF;
}
#cssmenu > ul > li.has-sub:hover > a:before {
top: 19px;
}
#cssmenu ul li.has-sub:hover > a {
background: #c00404;
border-color: #c00404;
padding-bottom: 13px;
z-index: 999;
}
#cssmenu ul li.has-sub:hover > ul,
#cssmenu ul li.has-sub:hover > div {
display: block;
}
#cssmenu ul li.has-sub > a:hover {
background: #c00404;
border-color: #c00404;
}
#cssmenu ul li > ul,
#cssmenu ul li > div {
display: none;
width: auto;
position: absolute;
top: 38px;
padding: 10px 0;
background: #9C2125;
border-radius: 0 0 5px 5px;
z-index: 999;
}
#cssmenu ul li > ul {
width: 160px;
}
#cssmenu ul li > ul li {
display: block;
list-style: inside none;
padding: 0;
margin: 0;
position: relative;
}
#cssmenu ul li > ul li a {
outline: none;
display: block;
position: relative;
margin: 0;
padding: 8px 20px;
font: 10pt Arial, Helvetica, sans-serif;
color: #ffffff;
text-decoration: none;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
}
#cssmenu,
#cssmenu > ul > li > ul > li a:hover {
background: #003d4a;
background: -moz-linear-gradient(top, #003d4a 0%, #013273 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #003d4a), color-stop(100%, #013273));
background: -webkit-linear-gradient(top, #003d4a 0%, #013273 100%);
background: -o-linear-gradient(top, #003d4a 0%, #013273 100%);
background: -ms-linear-gradient(top, #003d4a 0%, #013273 100%);
background: linear-gradient(top, #003d4a 0%, #013273 100%);
}
#cssmenu {
border-color: #c00404;
}
#cssmenu > ul > li > a {
border-right: 1px solid #c00404;
color: #FFF;
}
#cssmenu > ul > li > a:after {
border-color: #fb2f2f;
}
#cssmenu > ul > li > a:hover {
background: #c00404;
color: #ffffff;
}
#cssmenu ul ul a:hover {
color: #deb40d;
font-weight:bold;
}
#cssmenu > ul > li.has-sub > a:hover:before {
border-top: 5px solid #ffffff;
}
I have two issues:
- The menu on the desktop doesn’t stretch to fit across the full width of the screen; the last two items drop down a line when there is still space for them to fit. How can I fix this?
- What changes do I need to make to the css to make it respond as mobile for the iphone.css and phone.css? Do I need to add jquery, if so what script and where?
Please help!! I would really appreciate some help with this. Thanks a lot.