Solved

What is the proper syntax for adding CSS?

Posted on 2008-11-01
2
159 Views
Last Modified: 2008-11-02
I'm new to CSS and am trying to remove the vertical blank space between a drop down menu. I know that I need to add     margin:0px; padding:0px;     to my code but don't know where or how it should look in the completed code. Here is the page displaying the desired result and what I have now.

http://www.glowfishtw.com/flagfootball/menu.asp

Here is my page and attached is my style sheet. Could someone please show me how to change my code to make this work? thanks

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
      <title>CSS Horizontal Drop-Down Menu</title>      
                  
            
<!-- Begin Grab This - You'll need this external CSS file and the IE Statement below -->
<style type="text/css">@import url("menuh.css");</style>
<!--[if lt IE 7]>
<style type="text/css" media="screen">
#menuh{float:none;}
body{behavior:url(csshover.htc); font-size:100%;}
#menuh ul li{float:left; width: 100%; margin:0px; padding:0px;}
#menuh a{height:0%;font:bold 0.7em/1.4em arial, sans-serif;}
</style>
<![endif]-->
<!-- End Grab This -->

</head>

<body>


                <table width="667" border="1">
              <tr>
                <td><img src="images/example.jpg"></td>
                <td>
                        
<!-- Begin CSS Horizontal Popout Menu -->                        
                  <div id="menuh">                   
                    <ul>
                      <li><a href="#" class="top_parent"><img src="images/register.jpg" border='0'></a>
                    <ul>
                      <li><a href="#"><img src="images/winter.jpg" border='0'></a></li>
                      <li><a href="#"><img src="images/spring.jpg" border='0'></a></li>
                      <li><a href="#"><img src="images/fall.jpg" border='0'></a></li>
                      <li><a href="#"><img src="images/summer.jpg" border='0'></a></li>
                    </ul>
                    </li>
                  </ul>
                    </div>
                  <!-- End CSS Horizontal Popout Menu -->      </td>
                <td>&nbsp;</td>
              </tr>
            </table>
<p>&nbsp;                                                </p>
</body>
</html>




#menuh
	{
	font-size: small;
	font-family: arial, helvetica, sans-serif;
	width:100%;
	float:left;
	background-image: none;
	margin: 0px;
	}
		
#menuh a
	{
	text-align: center;
	display:block;
	border:0px;
	white-space:nowrap;
	margin:0;
	padding:0px;
	}
	
#menuh a:link, #menuh a:visited, #menuh a:active	/* menu at rest */
	{
	color: white;
	text-decoration:none;
	background-image: none;
	background-repeat: no-repeat;
	background-color: #GGGGGG;
	}
	
#menuh a:hover	/* menu at mouse-over  */
	{
	color: white;
	background-color: #0105A7;
	text-decoration:none;
	}	
	
 
#menuh ul
	{
	list-style:none;
	margin:0;
	padding:0;
	float:left;
	width:84px;     /* width of all menu boxes */
	height:10px;	/* height of all menu boxes */
	}
 
#menuh li
	{
	position:relative;
	min-height: 1px; 			/* Sophie Dennis contribution for IE7 */
	vertical-align: bottom; /* Sophie Dennis contribution for IE7 */
	background-image: none;
	margin:0px; 
	padding:0px;
	}
 
#menuh UL, LI  {margin:0px; padding:0px;}
 
#menuh IMG  { margin:0px; padding:0px; border:0px }
 
#menuh ul ul
	{
	position:absolute;
	z-index:500;
	top:auto;
	display:none;
	padding: 1em;
	margin:-1em 0 0 -1em;
	}
 
#menuh ul ul ul
	{
	top:0;
	left:100%;
	}
 
div#menuh li:hover
	{
	cursor:pointer;
	z-index:100;
	}
 
div#menuh li:hover ul ul,
div#menuh li li:hover ul ul,
div#menuh li li li:hover ul ul,
div#menuh li li li li:hover ul ul
{display:none;}
 
div#menuh li:hover ul,
div#menuh li li:hover ul,
div#menuh li li li:hover ul,
div#menuh li li li li:hover ul
{display:block;}
 
/* End CSS Drop Down Menu */

Open in new window

0
Comment
Question by:elliottbenzle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Expert Comment

by:lpxtech
ID: 22858882
There are a few methods,

Loading an external stylesheet can be done two ways. See code below.
Option 1:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Page</title>
<link rel="stylesheet" href="mystylesheet.css" media="all" />
</head>
 
Option 2:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Page</title>
<style type="text/css">@import("mystylesheet.css");</style>
</head>

Open in new window

0
 
LVL 44

Accepted Solution

by:
scrathcyboy earned 500 total points
ID: 22859482
#itemName        { ...your existing CSS here .... padding:0px; margin:0px; }
DIV                    { ...your existing CSS here .... padding:0px; margin:0px; }
DIV.menuh        { ...your existing CSS here .... padding:0px; margin:0px; }
A.link.class        { ...your existing CSS here .... padding:0px; margin:0px; }

It doesn't matter which CSS item you add it to, you just add it and you are done.  Whether classes, links, tags or element names, like DIV, just add it.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
tiny glitch in my main slider 3 48
ASP.NET Content Page 3 52
Prevent a display:none image from downloading on page load 5 68
Non-Resizable Pharagraph 2 19
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question