• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

cleaner approach to nav structure

Is  there a cleaner way to code this page?  I got it to work on a mac on safari, chrome and ff but it fails miserably in IE on a mac.  Seems to me there are a lot of div tags.  Maybe I could reduce that a bit and have it function better on ie.

  • 5
  • 5
3 Solutions
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
I wouldn't worry about ie on a mac.  ie9+/firefox/safari(mac)/chrome is where 95% or more of  your traffic is going to be on the desktop side.  Expect 20% to 50% on mobile/tablet using modern browsers.
nsitedesignsAuthor Commented:
Should I clean it up a bit?  Is it too code heavy?  Seems like some of the code is redundant but I could not get it to work without all the divs.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Those DW templates are pretty old.  I remember seeing the same from MX through cs5.5.  One of the things that template is doing is moving the side bar around and that may be creating issues.  

Here I have this loaded in bootstrap and placed the sidebar at the bottom.  It has the beginning of being responsive.

Does this look better on mac/ie? http://jsbin.com/padasQ_28350110/2/
<!DOCTYPE html>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<div class="container">
<div class="phone">   <p>(920) 458-9331</p></div>
<div class="header">
<div class="logo-container"><a href="index.html"><img src="http://nsitedesigns.com/nsitedesigns/rammer/img/logo.png" alt="Laura Rammer Dental Office" /></a> </div>
<div class="nav_container">
<div id="nav"><ul>
  <li><a href="#">Services</a></li>
  <li><a href="#">Meet Our Team </a></li>
  <li><a href="#">Links</a></li> 
  <li><a href="#">News/Events </a></li>
  <li><a href="#">Contact </a></li>
  <li><a href="#">Home</a></li></ul> 

    <img src="http://nsitedesigns.com/nsitedesigns/rammer/img/p_1.jpg" alt="Laura Rammer Dental Office" width="934" height="424" class="main_pic" />
  <div class="col-sm-9 content">
    <p>Be aware that the CSS for these layouts is heavily commented. If you do most of your work in Design view, have a peek at the code to get tips on working with the CSS for the fixed layouts. You can remove these comments before you launch your site. To learn more about the techniques used in these CSS Layouts, read this article at Adobe's Developer Center - <a href="http://www.adobe.com/go/adc_css_layouts">http://www.adobe.com/go/adc_css_layouts</a>.</p>
    <h2>Clearing Method</h2>
    <p>Because all the columns are floated, this layout uses a clear:both declaration in the .footer rule.  This clearing technique forces the .container to understand where the columns end in order to show any borders or background colors you place</p>
    <p>An image placeholder was used in this layout in the .header where you'll likely want to place  a logo. It is recommended that you remove the placeholder and replace it with your own linked logo. </p>
    <p> Be aware that if you use the Property inspector to navigate to your logo image using theackground color on any div will only show for the length of the content. This means if you're using a background color or border to create the look of a side column, it won't extend all the way to the footer but will stop when the content ends. If the .content div will always contain more content, you can place a border on the .content div to divide it from the column.</p>
    <!-- end .content --></div>
  <div class="col-sm-3 sidebar1">

    <h2>Gentle But Thorough</h2>
    <p>Buipsum dolor sit amet, consectetur adipiscing elit. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. </p>
    <p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
    <p> John Doe      <br>
    Sheboygan, WI</p>
    <!-- end .sidebar1 --></div>
   <div class="col-sm-12 footer">
    <p>Dr. Laura J. Rammer DDS &nbsp;&nbsp; |&nbsp;&nbsp;  604 Michigan Avenue &nbsp;&nbsp; |&nbsp;&nbsp; Sheboygan, WI 53081 &nbsp;&nbsp; |&nbsp;&nbsp; (920) 458-9331</p>
    <!-- end .footer --></div>
  <!-- end .container --></div>

Open in new window

body {
	font-family:Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif;
	font-size:1 em;
	margin: 0;
	padding: 0;
	color: #717074;
	background-color: #8fb6a4; /*teal*/
.container {
	background-color: #FFF;
	margin: 30px auto 30px auto;

/*  ........ NAVIGATION .......*/
	.nav_container {
	float: left;
	width: 637px;
	padding-bottom: 30px;

	#nav {
display: inline-block; 

#nav ul li {
display:inline; /*needed for ie bug*/
height:72px; /*matches height of logo */

	#nav li a {
color: #6d6e72; /*gray*/
padding:40px 5px 5px 5px;/* top padding for m/o effect*/

#nav ul {
	list-style: none ;
	display: inline ;}
#nav li a:hover {
background-color: #96caba; /* lt teal*/
	#nav li ul {
    display: none;
    float: left;
    padding: 0;
    position: absolute;}

Open in new window

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

nsitedesignsAuthor Commented:
Thanks for your work.  However, it kinda messed up the layout.  See link below:

Ideally, I wanted the layout to look like below with the phone number upper right and the logo below phone number on left.  THe nav bar needs to be at same plane as the logo only pushed to the right.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
I did that in less then 5 minutes time.  I think with a little tlc it could get that way.  I just wanted to introduce using a responsive library and css grid.

As far as the div's they are all good. My preference would be to put the right column mark up at after the the main content.

<div container >
    <div header></div>
    <div main></div>
    <div right></div>
    <div footer></div>

Open in new window

I checked out your orig link in ie 10 and it looked fine.
nsitedesignsAuthor Commented:
Good call on moving the sidebar below the content div.  I will make that change.  

As a sidenote, I took an 8 hour bootstrap online course.  Was interesting but intimidating.
nsitedesignsAuthor Commented:
p.s.  I am working with training wheels and trying to make this site responsive - thanks to your initial work and inspiration.  Where did you link to the css file for styling?  I only see the boostrap css.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Take it in steps and perhaps start out using only classes for xs like col-xs-6.  That way the page will be similar to a static  layout.

But when you get to responsive, you have to think through each page as to how it will look for each of the 4 sizes.  
Below will create a large main content area with a right sidebar for all screens except for the phone it will both the left and right will stack.  It's paint by numbers.  Once you get over the learning curve, it will go much faster and you will kick yourself for not adopting earlier.
<div id="main" class="row">
  <div id="left" class="col-xs-12 col-sm-9">
  <div id="right" class="col-xs-12 col-sm-3">

Open in new window

nsitedesignsAuthor Commented:
Cool - thanks.  

1.  How do I edit the bootstrap.css?
2.  How are you linking to MY css file?  I do not see it referenced in the html
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
>  How do I edit the bootstrap.css?

You don't.  Instead, you should create a new css file typically called, "custom.css" and place your own styles for things like colors, fonts, navigation etc.  You want to load the custom.css after the bootstrap.css.

>How are you linking to MY css file?

Do you mean in the jsbin link?  http://jsbin.com/padasQ_28350110/2/edit?html,css,output
I added it in the css tab.  It acts like working in the "custom.css" file.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now