Skip navigation
Currently Being Moderated

Gap between header and spry menu bar (school project)?

Apr 10, 2012 9:15 PM

Hello I have a project for school and they want me to have a html dw premade layout, with a header image, and a spry menu bar located in the header. Which I have done but there is this little gap between the header image and the spry menu bar and the header that i can't get rid of. There is no extra paragraph or line break tags in there, I have NO idea what is wrong, please help if you know. Thanks.

Attached below is the html and css. Sorry it has all the premade dw text in it too. At the bottom I also attached the external css for the page and the spry menu bar, just in case.

 

<!DOCTYPE HTML>

<html>

<head>

<meta charset="UTF-8">

<title>Rapids Transit - Buffalo River Outfitters</title>

<link href="css/rapids_transit.css" rel="stylesheet" type="text/css">

<style type="text/css">

<!--

body {

    font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;

    background: #42413C;

    margin: 0;

    padding: 0;

    color: #000;

}

 

/* ~~ Element/tag selectors ~~ */

ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */

    padding: 0;

    margin: 0;

}

h1, h2, h3, h4, h5, h6, p {

    margin-top: 0;     /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */

    padding-right: 15px;

    padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */

}

a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */

    border: none;

}

/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */

a:link {

    color: #42413C;

    text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */

}

a:visited {

    color: #6E6C64;

    text-decoration: underline;

}

a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */

    text-decoration: none;

}

 

/* ~~ this fixed width container surrounds the other divs ~~ */

.container {

    position:relative;

    width: 960px;

    background: #FFF;

    margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */

}

 

/* ~~ the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo ~~ */

.header {

    background-color: #fff;

    padding-right: 5px;

    padding-left: 5px;

}

 

/* ~~ This is the layout information. ~~

 

1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.

 

*/

 

.content {

    padding-top: 10px;

    padding-right: 0;

    padding-bottom: 10px;

    padding-left: 0;

}

 

/* ~~ The footer ~~ */

.footer {

    padding: 10px 0;

    background: #CCC49F;

}

 

/* ~~ miscellaneous float/clear classes ~~ */

.fltrt {  /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */

    float: right;

    margin-left: 8px;

}

.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */

    float: left;

    margin-right: 8px;

}

.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */

    clear:both;

    height:0;

    font-size: 1px;

    line-height: 0px;

}

-->

</style>

<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>

<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">

<style type="text/css">

#river_level {

    position:absolute;

    left:500px;

    top:325px;

    width:245px;

    height:80px;

    z-index:1;

    background-color: #ffcc33;

    border-top-style: inset;

    border-right-style: inset;

    border-bottom-style: inset;

    border-left-style: inset;

    border-top-color: #960;

    border-right-color: #960;

    border-bottom-color: #960;

    border-left-color: #960;

    text-align: center;

    font-family: Verdana, Geneva, sans-serif;

    font-size: medium;

}

</style>

</head>

 

<body>

 

<div class="container">

 

  <div class="header"><a href="#"><img src="assets/rt_banner.jpg" alt="Rapids Transit banner" width="950" height="120" /></a>

    <ul id="MenuBar1" class="MenuBarHorizontal">

      <li><a href="index.html">Home</a></li>

      <li><a href="guides.html">Our Guides</a></li>

      <li><a href="rates.html">Rates</a></li>

      <li><a href="lodging.html">Lodging</a></li>

      <li><a href="before.html">Before You Go</a></li>

    </ul>

  <!-- end .header --></div>

  <div class="content">

    <p align="left" class="body_text">Welcome to Rapids Transit. We are a river guide service and canoe rental located on the banks of the beautiful Buffalo River in Gilbert, Arkansas. We also offer kayak and raft rentals. Our experienced guides will be happy to suggest river trips tailored to any level - ranging from beginner to expert. They will also be happy to accompany you all the way! Stop by our country store and pick up your picnic supplies on the way out. We'll even pack it up for you in waterproof containers. (Just a precaution!) Give us a call to make your reservations.</p>

    <p align="left" class="contact_info">Rapids Transit<br />

      Hwy 55 North<br />

      Gilbert, Arkansas 75497<br />

      (555) 365-5228<br />

  <a href="mailto:mailbox@rapidstransit.com">Mike Andrew</a></p>

    <h1> </h1>

    <!-- end .content --></div>

  <div class="footer">

    <p><em>Copyright 2000 - 2012<br />

Last updated on

    <!-- #BeginDate format:Am1 -->April 10, 2012<!-- #EndDate -->

    </em></p>

    <!-- end .footer --></div>

<!-- end .container --><div id="river_level">Current River Conditions:<br>

good floating today<br>

with a few Class II spots</div></div>

<script type="text/javascript">

var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});

</script>

</body>

</html>

-------------------------------------------------------

ALSO HERE IS MY  EXTERNAL CSS

.body_text {

    font-family: Arial, Helvetica, sans-serif;

    font-size: 14px;

    font-style: normal;

}

.paragraph_header {

    font-family: Arial, Helvetica, sans-serif;

    font-size: 14px;

    font-style: normal;

    font-weight: bold;

    color: #036;

}

.contact_info {

    font-family: Arial, Helvetica, sans-serif;

    font-size: 14px;

    font-style: italic;

    color: #000;

}

-----------------------------------------------------

HERE IS MY SPRY MENU BAR CSS TOO

@charset "UTF-8";

 

/* SpryMenuBarHorizontal.css - version 0.6 - Spry Pre-Release 1.6.1 */

 

/* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */

 

/********************************************************************* **********

 

LAYOUT INFORMATION: describes box model, positioning, z-order

 

********************************************************************* **********/

 

/* The outermost container of the Menu Bar, an auto width box with no margin or padding */

ul.MenuBarHorizontal

{

    margin: 0;

    padding: 0;

    list-style-type: none;

    font-size: 14px;

    cursor: default;

    width: auto;

    font-family: Arial, Helvetica, sans-serif;

}

/* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */

ul.MenuBarActive

{

    z-index: 1000;

}

/* Menu item containers, position children relative to this container and are a fixed width */

ul.MenuBarHorizontal li

{

    margin: 0;

    padding: 0;

    list-style-type: none;

    font-size: 100%;

    position: relative;

    text-align: center;

    cursor: pointer;

    width: 190px;

    float: left;

    height: 25px;

}

/* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */

ul.MenuBarHorizontal ul

{

    margin: 0;

    padding: 0;

    list-style-type: none;

    font-size: 100%;

    z-index: 1020;

    cursor: default;

    width: 8.2em;

    position: absolute;

    left: -1000em;

}

/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */

ul.MenuBarHorizontal ul.MenuBarSubmenuVisible

{

    left: auto;

}

/* Menu item containers are same fixed width as parent */

ul.MenuBarHorizontal ul li

{

    width: 8.2em;

}

/* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */

ul.MenuBarHorizontal ul ul

{

    position: absolute;

    margin: -5% 0 0 95%;

}

/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */

ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible

{

    left: auto;

    top: 0;

}

 

/********************************************************************* **********

 

DESIGN INFORMATION: describes color scheme, borders, fonts

 

********************************************************************* **********/

 

/* Submenu containers have borders on all sides */

ul.MenuBarHorizontal ul

{

    border: 1px solid #CCC;

}

/* Menu items are a light gray block with padding and no text decoration */

ul.MenuBarHorizontal a

{

    display: block;

    cursor: pointer;

    background-color: #2E9712;

    padding: 0.5em 0.75em;

    color: #fff;

    text-decoration: none;

}

/* Menu items that have mouse over or focus have a blue background and white text */

ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus

{

    background-color: #33C;

    color: #FFF;

}

/* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */

ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible

{

    background-color: #3FA7A8;

    color: ##ffffff;

}

 

/********************************************************************* **********

 

SUBMENU INDICATION: styles if there is a submenu under a given menu item

 

********************************************************************* **********/

 

/* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */

ul.MenuBarHorizontal a.MenuBarItemSubmenu

{

    background-image: url(SpryMenuBarDown.gif);

    background-repeat: no-repeat;

    background-position: 95% 50%;

}

/* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */

ul.MenuBarHorizontal ul a.MenuBarItemSubmenu

{

    background-image: url(SpryMenuBarRight.gif);

    background-repeat: no-repeat;

    background-position: 95% 50%;

}

/* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */

ul.MenuBarHorizontal a.MenuBarItemSubmenuHover

{

    background-image: url(SpryMenuBarDownHover.gif);

    background-repeat: no-repeat;

    background-position: 95% 50%;

}

/* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */

ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover

{

    background-image: url(SpryMenuBarRightHover.gif);

    background-repeat: no-repeat;

    background-position: 95% 50%;

}

 

/********************************************************************* **********

 

BROWSER HACKS: the hacks below should not be changed unless you are an expert

 

********************************************************************* **********/

 

/* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */

ul.MenuBarHorizontal iframe

{

    position: absolute;

    z-index: 1010;

    filter:alpha(opacity:0.1);

}

/* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */

@media screen, projection

{

    ul.MenuBarHorizontal li.MenuBarItemIE

    {

        display: inline;

        f\loat: left;

        background: #FFF;

    }

}

 
Replies
  • Currently Being Moderated
    Apr 11, 2012 1:04 AM   in reply to Seaside333

    Add the below css selector to your css styes:

     

    .header img {

        display: block;

    }

     

     

    Amend your 'content' css selector to have top padding of 30px and also include clear: both; (as shown below).

     

    .content {

    padding-top: 30px;

    padding-right: 0;

    padding-bottom: 10px;

    padding-left: 0;

    clear: both;

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2012 9:34 AM   in reply to Seaside333

    Seaside333 wrote:

     

     

     

    I understand the content selector, and why to add the padding to the top, but what is the "clear:both;" do?

     

     

     

    clear: both; forces the <div>, in this case your 'content' <div>, below any floated element/s which preceeds it. You have floated elements in the spry navigation which needed to be 'cleared' which allows the 'content' <div> to take up its natural position in the html flow. Adding padding top just pushes the text in the <div> away from sitting flush against the bottom of the navigation bar.

     

     

    Seaside333 wrote:

     

    .header img {

        display: block;

    }

     

     

    Images don't sit on the baseline because they are what is know as 'inline' elements. Adding display: block; makes them 'block' level elements which dont have the space beneath.

     

    See the link below which explains about inline elements and the space:

     

    https://developer.mozilla.org/en/Images,_Tables,_and_Mysterious_Gaps

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points