I've been exploring online tutorials to create a responsive horizontal drop-down menu navigation bar using just CSS and HTML. The tutorial process has been smooth so far, but I'm aiming to make my navigation bar fluid so that it adjusts seamlessly to different browser sizes while maintaining its horizontal layout.
I've read about achieving this through fluid CSS by utilizing percentages (%) and ems instead of fixed pixel widths. Despite several attempts, I haven't been successful in making my navigation bar truly fluid. Can someone offer guidance on how to achieve this with fluid CSS?
Below is the snippet of my HTML code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Casa Magnolia Home Page</title>
<link rel="stylesheet" type="text/css" href="css/homePage.css"/>
</head>
<body>
<div id="wrapper" align="center">
<div id="header" align ="left">
<?php
include "ImageFunctions.php";//include the PHP class
//create an object of the class so that its methods can be accessed
$myImageFunction = new ImageFunctions();
$logo = $myImageFunction->logo();
//$data= $myImageFunction->getData();
?>
</div>
<div id ="menuWrapper" align="left">
<div id ="navMenu" align="center">
<ul>
<li><a href="#">Home</a></li><!-- end Home link -->
<li><a href="#">The House</a>
<ul>
<li><a href="#">Info</a></li>
<li><a href="#">Map</a></li>
<li><a href="#">Slide Show</a></li>
</ul>
</li><!-- ends the House info list -->
<li><a href="#">The Area</a>
<ul>
<li><a href="#">Map</a></li>
<li><a href="#">Info about the area</a></li>
<li><a href="#">Sites and Attractions</a></li>
<li><a href="#">Web Address</a></li>
</ul>
</li><!-- ends The Area info list -->
<li><a href ="#">Terms and Conditions</a>
<ul>
<li><a href="#">Payments</a></li>
<li><a href="#">Cancellation</a></li>
<li><a href="#">Security Deposits</a></li>
<li><a href="#">Smoking Policy</a></li>
<li><a href="#">Pets Policy</a></li>
<li><a href="#">Insurance</a></li>
<li><a href="#">Swimming Pool</a></li>
<li><a href="#">Pest Control</a></li>
<li><a href="#">Complaints</a></li>
<li><a href="#">Arrival/Departure</a></li>
<li><a href="#">Codes of Conduct</a></li>
<li><a href="#">Limits of Liability</a></li>
</ul>
</li><!-- end of Terms and Conditions list -->
<li><a href ="#">Book With Us</a></li><!-- end of Book with us Link -->
<li><a href ="#">Help</a>
<ul>
<li><a href="#">Contact Us</a></li>
</ul>
</li><!-- end of Help list -->
</ul> <!-- end main UL -->
<br class="clearFloat" />
</div><!-- end navMenu div -->
</div> <!-- ends the menuWrapper div -->
</div>
</body>
And here is the corresponding CSS code:
/*
Document : homePage
Created on : 16-Feb-2012, 17:00:56
Author : gerrard
Description:
Purpose of the stylesheet follows.
*/
@charset "utf-8";
#header
{
width: 100%;
height: 50px;
float: top;
background-color: beige;
margin:20px;
}
#menuWrapper
{
width: 100%;
height: 100%;
background-color: yellow;
margin: 10px;
}
#navMenu
{
width:100%;
height:100%;
float: center;
margin: 0;
padding: 0;
}
#navMenu ul
{
margin: 0;
padding: 0;
line-height: 30px;
}
#navMenu li
{
margin: 0;
padding: 0;
list-style: none;
float: left;
position: relative;
background: orchid;
}
#navMenu ul li a
{
text-align: center;
font-family: "Comic Sans MS", cursive;
text-decoration: none;
height: 40%;
width: 230px;
display: block;
color: yellow;
border: 1px solid #FFF;
text-shadow: 1px 1px 1px #000;
}
#navMenu ul ul
{
position: absolute;
visibility: hidden;
top: 32px;
}
#navMenu ul li:hover ul
{
visibility: visible;
}
/********************************************************************************/
#navMenu li:hover
{
background: visible;
}
#navMenu ul li:hover ul li a:hover
{
background: violet;
color: silver;
}
#navMenu a:hover
{
color: peachpuff;
}
.clearFloat
{
clear: both;
margin: 0;
padding: 0;
}