Fixed Dropdown Menu - html

I have a problem when my mouse hovering the dropdown menu, the dropdown container is gone. And also the menu dropdown is not steady. How can I fixed this? Please help me. Thanks a lot.
This is the JSfiddle.
.nav-bar {
position: fixed;
height: 30px;
top: 50px;
width: 100%;
background: #D9D9D9;
font-size: 13px;
color: #727272;
}
.line-nav img {
left: -50%;
top: 80px;
width: 150%;
height: 5px;
position: fixed;
}
#menu ul {
float: left;
margin: 7px 0 0 -20px;
font-weight: bold;
list-style: none;
display: inline;
}
#menu ul a {
text-decoration: none;
color: #727272;
padding-top: 0;
}
#menu ul a:hover {
color: #F4851E;
}
/* Dropdown Menu */
.dropdown_3columns {
margin: 5px auto;
float: left;
position: absolute;
left: -999em;
/* Hides the drop down */
text-align: left;
padding: 10px 5px 10px 5px;
border: 1px solid #777777;
border-top: none;
/* Gradient background */
background: #F4F4F4;
background: -moz-linear-gradient(top, #EEEEEE, #BBBBBB);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#EEEEEE), to(#BBBBBB));
/* Rounded Corners */
-moz-border-radius: 0px 5px 5px 5px;
-webkit-border-radius: 0px 5px 5px 5px;
border-radius: 0px 5px 5px 5px;
}
.dropdown_3columns {
width: 420px;
}
#menu ul:hover .dropdown_3columns {
left: -1px;
top: 25px;
}
/* Columns */
.col_1,
.col_2,
.col_3,
.col_4,
.col_5 {
display: inline;
float: left;
position: relative;
margin-left: 5px;
margin-right: 5px;
}
.col_1 {
width: 130px;
}
.col_2 {
width: 270px;
}
.col_3 {
width: 410px;
}
.col_4 {
width: 550px;
}
.col_5 {
width: 690px;
}
/* Right alignment */
#menu .menu_right {
float: right;
margin-right: 0px;
}
#menu ul .align_right {
/* Rounded Corners */
-moz-border-radius: 5px 0px 5px 5px;
-webkit-border-radius: 5px 0px 5px 5px;
border-radius: 5px 0px 5px 5px;
}
#menu ul:hover .align_right {
left: auto;
right: -1px;
top: auto;
}
/* Drop Down Content Stylings */
#menu p,
#menu h2,
#menu h3,
#menu ul ul {
font-family: Arial, Helvetica, sans-serif;
line-height: 21px;
font-size: 12px;
text-align: left;
text-shadow: 1px 1px 1px #FFFFFF;
}
#menu h2 {
font-size: 21px;
font-weight: 400;
letter-spacing: -1px;
margin: 7px 0 14px 0;
padding-bottom: 14px;
border-bottom: 1px solid #666666;
}
#menu h3 {
font-size: 14px;
margin: 7px 0 14px 0;
padding-bottom: 7px;
border-bottom: 1px solid #888888;
}
#menu p {
line-height: 18px;
margin: 0 0 10px 0;
}
#menu ul:hover div a {
font-size: 12px;
color: #015b86;
}
#menu ul:hover div a:hover {
color: #029feb;
}
<div class="nav-bar">
<div id="menu">
<ul>Home
<div class="dropdown_3columns">
<!-- Begin 2 columns container -->
<div class="col_2">
<h2>Welcome !</h2>
</div>
<div class="col_2">
<p>Hi and welcome here ! This is a showcase of the possibilities of this awesome Mega Drop Down Menu.</p>
<p>This item comes with a large range of prepared typographic stylings such as headings, lists, etc.</p>
</div>
</div>
<!-- End 2 columns container -->
</ul>
<ul>Product
<div class="dropdown_3columns">
<!-- Begin 2 columns container -->
<div class="col_2">Contain Product</div>
<div class="col_1">Contain Product</div>
<div class="col_2">Contain Product</div>
</div>
<!-- End 2 columns container -->
</ul>
<ul>Contact
</ul>
<ul>About Us
</ul>
</div>
<div class="line-nav">
<img src="http://www.iconsdb.com/icons/preview/caribbean-blue/square-xxl.png" />
</div>
</div>

Related

Expandable Search Form

I am working on Expandable Search but facing one problem. When i click on search bar then search bar is expanding. But right side content is moving down. I wanna hide right side content when search bar is expand similar to stackoverflow search bar.
body {
margin: 0;
padding: 0;
}
.mainheader {
width: 100%;
background-color: #FAFAFB;
border-top: 3px solid #F48024;
float: left;
padding-bottom: 10px;
-moz-box-shadow: 3px 3px 5px 1px #ccc;
-webkit-box-shadow: 3px 3px 5px 1px #ccc;
box-shadow: 3px 3px 5px 1px #ccc;
}
.innerheader {
width: 1000px;
margin: auto;
}
.logo_name {
display: inline-block;
margin-top: 13px;
line-height: 1em;
font-family: helvetica, arial, sans-serif;
font-weight: bold;
background: linear-gradient(to right, #7db9e8 50%,#1e5799 50%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 22px;
}
.ga_a {
float: left;
}
.ga_b {
float: left;
padding: 5px;
padding-bottom: 10px;
margin-top: 5px;
}
.ga_b ul {
margin: 0px;
padding: 0px;
margin-left: 7px;
line-height:1;
}
.ga_b ul>li {
display:inline-block;
margin-left: 5px;
padding: 5px;
}
.ga_b ul>li a {
text-decoration: none;
color: black;
font-size: 15px;
font-family: "Lucida Grande",Arial,Helvetica,Verdana,sans-serif;
}
.ga_b ul>li:hover {
background-color: #ECECEC;
}
.ga_c {
float: left;
}
.ga_c input {
outline: none;
}
.ga_c input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
margin-left: 10px;
}
.ga_c input::-webkit-search-decoration,
.ga_c input::-webkit-search-cancel-button {
display: none;
}
.ga_c input[type=search] {
background: #ededed url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #ffffff;
padding: 9px 10px 9px 32px;
width: 175px;
border-radius: 5px;
margin-top: 5px;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
.ga_c input[type=search]:focus {
width: 400px;
background-color: #fff;
-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
box-shadow: 0 0 5px rgba(109,207,246,.5);
}
.ga_c input:-moz-placeholder {
color: #999;
}
.ga_c input::-webkit-input-placeholder {
color: #999;
}
.ga_d {
float: left;
}
.ga_d ul>li {
display: inline-block;
display: fixed;
}
<div class="mainheader">
<div class="innerheader">
<div class="ga_a">
<a class="navbar-brand logo_name" href="#">WebSiteName</a>
</div>
<div class="ga_b">
<ul>
<li>Text One</li>
<li>Text Two</li>
<li>Text Three</li>
</ul>
</div>
<div class="ga_c">
<form>
<input type="search" placeholder="Search">
</form>
</div>
<div class="ga_d">
<ul>
<li>Login</li>
<li>Register</li>
</ul>
</div>
</div>
</div>
You can do it with the positioning:
* {box-sizing: border-box} /* recommended */
body {
margin: 0;
padding: 0;
}
.mainheader {
width: 100%;
min-width: 1000px; /* added / needs to match the .innerheader width */
margin: 0 auto; /* added */
background-color: #FAFAFB;
border-top: 3px solid #F48024;
float: left;
padding-bottom: 10px;
-moz-box-shadow: 3px 3px 5px 1px #ccc;
-webkit-box-shadow: 3px 3px 5px 1px #ccc;
box-shadow: 3px 3px 5px 1px #ccc;
}
.innerheader {
width: 1000px;
margin: 0 auto; /* modified */
}
.logo_name {
display: inline-block;
margin-top: 13px;
line-height: 1em;
font-family: helvetica, arial, sans-serif;
font-weight: bold;
background: linear-gradient(to right, #7db9e8 50%,#1e5799 50%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 22px;
}
.ga_a {
float: left;
}
.ga_b {
float: left;
padding: 5px;
padding-bottom: 10px;
margin-top: 5px;
}
.ga_b ul {
margin: 0;
padding: 0;
margin-left: 7px;
line-height: 1;
}
.ga_b ul>li {
display:inline-block;
margin-left: 5px;
padding: 5px;
}
.ga_b ul>li>a {
text-decoration: none;
color: #000; /*black*/
font-size: 15px;
font-family: "Lucida Grande",Arial,Helvetica,Verdana,sans-serif;
}
.ga_b ul>li:hover {
background: #ECECEC;
}
.ga_c {
position: relative; /* needs to be set because of the absolute positioned child */
float: left;
}
.ga_c input {
outline: none;
}
.ga_c input[type=search] {
position: absolute; /* needs to be positioned absolutely, i.e. be removed from the normal document flow so that it can "overlay" and other element, of course the z-index needs to be set */
z-index: 9999; /* usually something big just to be sure it stays on top / in front of everything else */
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
margin-left: 10px;
}
.ga_c input::-webkit-search-decoration,
.ga_c input::-webkit-search-cancel-button {
display: none;
}
.ga_c input[type=search] {
background: #ededed url(https://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #fff;
padding: 9px 10px 9px 32px;
width: 175px;
border-radius: 5px;
margin-top: 5px;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
.ga_c input[type=search]:focus {
width: 400px;
background-color: #fff;
-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
box-shadow: 0 0 5px rgba(109,207,246,.5);
}
.ga_c input:-moz-placeholder {
color: #999;
}
.ga_c input::-webkit-input-placeholder {
color: #999;
}
.ga_d {
position: relative; /* positioned relative to its normal position so that we can move it with "directional" properties */
left: 229px; /* moved to the right by the width of the .ga_c (inspected the element) */
float: left;
}
.ga_d ul>li {
display: inline-block;
display: fixed;
}
<div class="mainheader">
<div class="innerheader">
<div class="ga_a">
<a class="navbar-brand logo_name" href="#">WebSiteName</a>
</div>
<div class="ga_b">
<ul>
<li>Text One</li>
<li>Text Two</li>
<li>Text Three</li>
</ul>
</div>
<div class="ga_c">
<form>
<input type="search" placeholder="Search">
</form>
</div>
<div class="ga_d">
<ul>
<li>Login</li>
<li>Register</li>
</ul>
</div>
</div>
</div>
With your structure, it is not possible using css only. However if change the structure you could have something like this.
*{
box-sizing: border-box;
font-family: arial;
}
input{
padding: 10px;
background: #eee;
border: 1px solid #ddd;
display: inline-block;
transition: .3s;
margin-right: 10px;
width: 250px;
}
input:focus{
width: 400px;
}
input:focus + div{
opacity: 0;
visibility: hidden;
}
ul{
padding: 0;
margin: 0;
}
ul li{
display: inline;
margin-right: 5px;
}
div {
display: inline-block;
transition: .3s;
}
<input type="search" placeholder="Search">
<div class="ga_d">
<ul>
<li>Login</li>
<li>Register</li>
</ul>
</div>

HTML Drop down menu hidden by image

I have a website home page which has a menu (with a drop down) than an image (with text overplayed). For whatever reason the image is floating above the menu, so when you hover on the drop down it hides the menu behind the image.
HTML
* {
margin: 0;
padding: 0;
}
body {
background-color: #f3f3f3;
}
nav {
width: 100%;
height: 60px;
background-color: #fff;
position: fixed;
}
nav p {
font-family: arial;
color: #222;
font-size: 22px;
line-height: 55px;
float: left;
padding-left: 20px;
}
nav ul li {
list-style: none;
float: left;
position: relative;
text-transform: uppercase;
}
nav ul li a {
display: block;
padding: 21px 14px;
font-family: arial;
color: #222;
text-decoration: none;
}
nav ul li img {
float: right;
width: 8px;
padding-left: 6px;
position: relative;
top: 5px;
}
nav ul li ul {
display: none;
position: absolute;
padding: 10px;
background-color: #fff;
border-radius: 0px 0px 4px 4px;
}
nav ul li:hover ul {
display: block;
}
nav ul li ul li {
clear: both;
width: 180px;
border-radius: 4px;
}
nav ul li ul li a {
display: block;
padding: 11px 10px;
font-family: arial;
color: #222;
text-decoration: none;
}
nav ul li ul li:hover {
background-color: #eee;
}
.wrapper {
padding: 0px 0px
}
.search form {
list-style: none;
float: right;
position: relative;
padding-top: 8px;
padding-right: 20px;
}
.search input[type=text] {
width: 132px;
box-sizing: border-box;
border: 0.5px solid #ccc;
border-radius: 2px;
font-size: 16px;
background-color: white;
background-image: ('img/searchicon.png');
background-position: 10px 10px;
padding: 12px 20px 12px 40px;
}
.search input[type=text]:focus {
width: 300px;
}
.image {
position: relative;
width: 100%; /* for IE 6 */
}
h2 {
position: absolute;
top: 200px;
left: 0;
width: 100%;
}
h2 span {
color: white;
font: bold 24px/45px Helvetica, Sans-Serif;
letter-spacing: -1px;
background: rgb(0, 0, 0); /* fallback color */
background: rgba(0, 0, 0, 0.7);
padding: 10px;
}
h2 span.spacer {
padding:0 5px;
} here
<header>
<nav>
<p>Website Name</p>
<ul>
<li>Home</li>
<li>Resources <img src="img/dropdown.png">
<ul>
<li>About</li>
<li>Archives</li>
<li>Contact</li>
</ul>
</li>
<li>Login</li>
</ul>
<div class="search">
<form>
<input type="text" name="search" placeholder="Search...">
</form>
</div>
</nav>
</header>
<p style="line-height:400%"> </p>
<section>
<div class="image">
<img src="img/Shome.jpg" alt="Rowing" width="100% height="500px">
<h2><span>Site Name: <br /> Portal and Online Archives</span></h2>
</div>
</section>
Use z-index for making the dropdown above the image.An element with greater z-index will be on the top of that with lower z-index
* {
margin: 0;
padding: 0;
}
body {
background-color: #f3f3f3;
}
nav {
width: 100%;
height: 60px;
background-color: #fff;
position: fixed;
}
nav p {
font-family: arial;
color: #222;
font-size: 22px;
line-height: 55px;
float: left;
padding-left: 20px;
}
nav ul li {
list-style: none;
float: left;
position: relative;
text-transform: uppercase;
}
nav ul li a {
display: block;
padding: 21px 14px;
font-family: arial;
color: #222;
text-decoration: none;
}
nav ul li img {
float: right;
width: 8px;
padding-left: 6px;
position: relative;
top: 5px;
}
nav ul li ul {
display: none;
position: absolute;
padding: 10px;
background-color: #fff;
border-radius: 0px 0px 4px 4px;
}
nav ul li:hover ul {
display: block;
}
nav ul li ul li {
clear: both;
width: 180px;
border-radius: 4px;
}
nav ul li ul li a {
display: block;
padding: 11px 10px;
font-family: arial;
color: #222;
text-decoration: none;
}
nav ul li ul li:hover {
background-color: #eee;
}
.wrapper {
padding: 0px 0px
}
.search form {
list-style: none;
float: right;
position: relative;
padding-top: 8px;
padding-right: 20px;
}
.search input[type=text] {
width: 132px;
box-sizing: border-box;
border: 0.5px solid #ccc;
border-radius: 2px;
font-size: 16px;
background-color: white;
background-image: ('img/searchicon.png');
background-position: 10px 10px;
padding: 12px 20px 12px 40px;
}
.search input[type=text]:focus {
width: 300px;
}
.image {
position: relative;
width: 100%; /* for IE 6 */
}
h2 {
position: absolute;
top: 200px;
left: 0;
width: 100%;
}
h2 span {
color: white;
font: bold 24px/45px Helvetica, Sans-Serif;
letter-spacing: -1px;
background: rgb(0, 0, 0); /* fallback color */
background: rgba(0, 0, 0, 0.7);
padding: 10px;
}
h2 span.spacer {
padding:0 5px;
} here
<header>
<nav>
<p>Website Name</p>
<ul>
<li>Home</li>
<li>Resources <img src="img/dropdown.png">
<ul>
<li>About</li>
<li>Archives</li>
<li>Contact</li>
</ul>
</li>
<li>Login</li>
</ul>
<div class="search">
<form>
<input type="text" name="search" placeholder="Search...">
</form>
</div>
</nav>
</header>
<p style="line-height:400%"> </p>
<section>
<div class="image">
<img src="img/Shome.jpg" alt="Rowing" width="100% height="500px">
<h2><span>Site Name: <br /> Portal and Online Archives</span></h2>
</div>
</section>

CSS Drop-down Sub-menu Erroneously Modifying Parent Width

I have been fiddling with CSS-based drop-down navigation on my website and ran into some trouble with the sub-menus modifying the width of the parent menus. When a sub-drop-down is opened, the parent drop-down will enlarge to match the width. If sub-drop-down menus are smaller than the parent, they appear to be using the width of the parent menus for their horizontal offset instead of their own width, which creates a gap.
I have pulled together a live example here: http://jsfiddle.net/vwLf9f3w/2/
Sorry for the large quantity of CSS; I have pulled the relevant code to the top.
Here is the CSS just for my navigation:
/* ----------- Navigation ----------- */
div.nav
{
display: block;
position: absolute;
top: 83px;
left: 470px;
height: 47px;
width: 530px;
background-color: transparent;
z-index: 21;
padding: 0px;
margin: 0;
font-size: 16px;
}
/* ------ [ NAV LINKS ] ------- */
/* Primary header links */
div.nav > ul > li > a
{
display: block;
background-color: transparent;
text-align: center;
height: 24px;
width: 96px;
background-color: #a9a9a9;
border: 1px solid #666666;
border-radius: 3px;
margin-top: 6px;
margin-bottom: 6px;
margin-left: 6px;
padding: 6px 0px 0px 0px;
}
div.nav > ul > li:hover > a
{
background-color: #8bbbdd;
}
/* All header links */
div.nav a
{
color: #000000;
text-decoration: none;
}
/* Header Sub-links */
div.nav > ul > li li > a
{
display: block;
padding: 0px 0px;
padding-top: 6px;
padding-bottom: 6px;
padding-left: 20px;
padding-right: 20px;
margin-top: 0px;
margin-left: 0px;
background: #a9a9a9;
color: #000000;
}
div.nav > ul > li li > a:hover, div.nav > ul ul li:hover > a
{
background: #8bbbdd;
}
/* ------ [ NAV LISTS ] ------- */
/* Primary navigation items */
div.nav > ul > li
{
display: inline-block;
background-color: transparent;
vertical-align: top; /* here */
max-width: 104px;
overflow: show;
}
/* Primary navigation list */
div.nav > ul
{
display: inline-block;
width: 650px;
margin: 0px;
}
/* Secondary navigation lists */
div.nav > ul ul
{
z-index: 0;
white-space:nowrap;
border: 1px solid #666666;
border-radius: 3px;
padding: 0 0 0 0;
list-style: none;
position: relative;
display: none;
background-color: transparent;
background: URL(images/blank.gif);/*#000;transparent; IE FIX*/
padding: 0;
left: 6px;
top: -3px;
position: relative;
margin-bottom: 0px;
margin-left: 0px;
width: auto;
height: auto;
}
div.nav ul li:hover > ul
{
display: inline-block;
}
/* Secondary list items */
div.nav > ul > li li
{
max-height: 31px;
}
/* Tertiary menu list */
div.nav > ul ul ul
{
top: -36px;
left: -100%;
position: relative;
}
And here is the relevant HTML:
...
<div class="nav">
<ul>
<li>Home
</li><li>Tech
<ul>
<li>Subject 1</li>
<li>Subject 2
<ul>
<li>An Item</li>
<li>Some Other Item</li>
<li>And Yet Another!</li>
<li>I Am Running Out of Ideas
<ul>
<li>Even More To Show Expansion</li>
<li>And More</li>
<li>And More!</li>
</ul>
</li>
<li>One Last Item</li>
</ul>
</li>
<li>Subject 3</li>
<li>Subject 4</li>
</ul>
</li><li>Personal
<ul>
<li>Subject 1
<ul>
<li>1111</li>
<li>2222</li>
<li>3333</li>
<li>4444
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>5555</li>
</ul>
</li>
<li>Subject 2</li>
<li>Subject 3</li>
</ul>
</li><li>Software
<ul>
<li>Subject 1</li>
<li>Subject 2</li>
<li>Subject 3</li>
</ul>
</li><li>Contact
<ul>
<li>Subject 1</li>
<li>Subject 2</li>
<li>Subject 3</li>
</ul>
</li>
</ul>
</div>
...
To summarize: How can I get each navigation sub-menu to have its own size that will not modify the size of other menus? And, how can I get the sub-menus to reference their own width rather than their parents' to prevent gaps?
All suggestions are welcome; my apologies for the unpolished code.
Parent element expansion:
The reason that your parent elements are expanding is because you are are not using absolute positioning on your child menus and the parent width is adjusting accordingly to the wider child elements. You will need to add position:relative; to div.nav > ul > li li and position: absolute; to div.nav > ul ul ul to remove your child menus from the flow so they don't widen your parent elements.
Sub Menu Alignment and Gap Elimination:
Sub Menus on right side of dropdown:
div.nav > ul ul ul {
left: 100%; /* All the way to the right of parent */
position: absolute;
}
Sub menus on left side of dropdown:
div.nav > ul ul ul {
left: auto; /* reset */
position: absolute;
right: 100%; /* All the way to the leftt of parent */
}
Sub Menu Vertical Alignment:
I also changed the top position on your sub menus to adjust the alignments for the 1px border and the 4px top margin on your ULs.
div.nav > ul ul {
top: -5px; / * corrects sub menu top alignment */
}
Take a look at the snippet below. It is set up with menus on the right side of the dropdown.
/* ===============----------- Navigation -----------=============== */
div.nav
{
display: block;
position: absolute;
top: 83px;
left: 470px;
height: 47px;
width: 530px;
background-color: transparent;
z-index: 21;
padding: 0px;
margin: 0;
font-size: 16px;
}
/* ------ [ NAV LINKS ] ------- */
/* Primary header links */
div.nav > ul > li > a {
display: block;
background-color: transparent;
text-align: center;
height: 24px;
width: 96px;
background-color: #a9a9a9;
border: 1px solid #666666;
border-radius: 3px;
margin-top: 6px;
margin-bottom: 6px;
margin-left: 6px;
padding: 6px 0px 0px 0px;
}
div.nav > ul > li:hover > a {
background-color: #8bbbdd;
}
/* All header links */
div.nav a {
color: #000000;
text-decoration: none;
}
/* Header Sub-links */
div.nav > ul > li li > a {
display: block;
padding: 0px 0px;
padding-top: 6px;
padding-bottom: 6px;
padding-left: 20px;
padding-right: 20px;
margin-top: 0px;
margin-left: 0px;
background: #a9a9a9;
color: #000000;
}
div.nav > ul > li li > a:hover, div.nav > ul ul li:hover > a {
background: #8bbbdd;
}
/* ------ [ NAV LISTS ] ------- */
/* Primary navigation items */
div.nav > ul > li {
display: inline-block;
background-color: transparent;
vertical-align: top; /* here */
max-width: 104px;
overflow: show;
}
/* Primary navigation list */
div.nav > ul {
display: inline-block;
width: 650px;
margin: 0px;
}
/* Secondary navigation lists */
div.nav > ul ul {
z-index: 0;
white-space:nowrap;
border: 1px solid #666666;
border-radius: 3px;
padding: 0 0 0 0;
list-style: none;
position: relative;
display: none;
background-color: transparent;
background: URL(images/blank.gif);/*#000;transparent; IE FIX*/
padding: 0;
left: 6px;
top: -5px; /* corrects sub menu top alignment */
position: relative;
margin-bottom: 0px;
margin-left: 0px;
width: auto;
height: auto;
}
div.nav ul li:hover > ul {
display: inline-block;
}
/* Secondary list items */
div.nav > ul > li li {
max-height: 31px;
position: relative; /* required for child menu absolute positioning */
}
/* Tertiary menu list */
div.nav > ul ul ul {
position: absolute; /* removes child sub menu from flow and stops the expandsion of parent element */
left: 100%; /* positions sub menu to right side of parent */
}
/* =======-------- Shouldn't Be Relevant Beyond Here --------======= */
/* Page Setup */
#font-face
{
font-family: 'DejaVu Sans';
src: local(default_font), url('fonts/DejaVuSans.ttf') format('truetype');
font-weight: normal;
font-style: normal;
font-variant: normal;
}
#font-face
{
font-family: 'DejaVu Sans';
font-weight: bold;
font-style: normal;
font-variant: normal;
src: local('DejaVu Sans'), url('fonts/DejaVuSans.ttf') format('truetype');
}
#font-face
{
font-family: 'DejaVu Sans';
font-weight: normal;
font-style: italic;
font-variant: normal;
src: local('DejaVu Sans'), url('fonts/DejaVuSans.ttf') format('truetype');
}
*
{
padding: 0;
margin: 0;
border: 0;
/*font-family: "Arial", Gadget, sans-serif;*/
font-family: "DejaVu Sans", "Arial", "Gadget", "sans-serif";
color: #000;
}
.clearfix:after
{
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
font-size: 0;
}
* html .clearfix
{
height: 1%;
}
.clearfix
{
display: block;
}
html, body
{
min-height: 100%;
}
body
{
background: url(images/background.png) repeat; /*no-repeat*/
/*background-attachment: fixed;
background-size: cover;*/
font-family: Geneva, Arial, Helvetica, san-serif;
height: 100%;
min-height: 100%;
}
/* Main body components */
.header
{
height: 128px;
text-indent: -9999px;
margin: -1px 0px 0px 0px;
border-bottom: 0px solid #000;
padding: 0px;
}
#container
{
display: block;
position: relative;
width: 1000px; /* 750px */
height: 100%;
margin: 0 auto;
padding: 0px;
background-color: #fff;
box-shadow: 0px 0px 5px #888888;
border-bottom: 4px #000 solid;
margin-bottom: 32px;
z-index: 1;
}
.slideshow
{
display: block;
text-align: center;
margin-left: 0px;
margin-bottom: 24px;
}
#hide
{
display: none;
}
.announcement
{
/*color: #B0B0B0;*/
position: absolute;
top: 140px; left: 425px;
height: 47px; width:575px;
z-index: 20;
}
.selectable
{
}
.selectable:hover
{
cursor: pointer;
background-color: #F3F3FF;
}
#pagecategory
{
font-family: "League Gothic", "Arial", "sans-serif" !important;
letter-spacing: .02em;
position: absolute;
top: 128px;
left: 0px;
width: 400px;
height: 35px;
text-align: center;
padding-right: 32px;
background-color: transparent;
padding-top: .25em;
font-size: 24px;
/*text-shadow: 0 0 3px #777777;*/
}
/* Simple elements */
a
{
color: #FF6600 ;/*#151B8D; HYPERLINK 0066CC*/
font-style: bold;
/*text-shadow: 0.1em 0.1em 0.1em black;*/
text-decoration: none;
}
a:hover
{
text-decoration: underline;
}
a.a_subtle
{
color: #888;
font-style: italic;
text-decoration: none;
}
a.a_subtle:hover
{
color: #0000ff;
font-style: regular;
text-decoration: underline;
}
a.a_download
{
display: block;
color: #444444;
font-size: 20px;
text-decoration: none;
text-decoration: underline;
clear: left;
}
a.a_download:hover
{
color: #0000ff;
}
glowred
{
color: rgb(255, 102, 0);
/*text-shadow: 0.1em 0.1em 0.1em black;*/
}
.buildsbox
{
text-align: left;
display: inline-block;
border: 1px solid #bbbbbb;
border-radius: 3px;
padding: 12px;
overflow: scroll;
max-height: 512px;
width: 700px;
}
input
{
margin-bottom: 8px;
}
input[type="text"], textarea
{
border: 1px solid;
font-size: 16px;
padding: 3px;
}
input[type="submit"]
{
border: 1px solid;
font-size: 16px;
padding: 3px;
}
input[type="submit"]:hover
{
background-color: #CCCCFF;
cursor: pointer;
}
label
{
font-size: 15px;
}
.errorbox
{
display: block;
margin-top: 5px;
margin-bottom: 5px;
border: 1px dashed #903333;
border-radius: 2px;
padding: 5px;
background-color: #FFBBBB;
}
.successbox
{
display: block;
margin-top: 5px;
margin-bottom: 5px;
border: 1px dashed #339033;
border-radius: 2px;
padding: 5px;
background-color: #BBFFBB;
}
/* Posts/text */
h1
{
font-family: "League Gothic", arial, sans-serif !important;
text-align: left;
font-size: 30px;
font-weight: normal;
margin-bottom: 16px;
display: block;
}
h2
{
font-family: "League Gothic", arial, sans-serif !important;
margin-bottom: 8px;
margin-top: 16px;
display: block;
font-size: 16px;
letter-spacing: .02em;
font-weight: 700 !important;
}
em, i
{
font-style: italic !important;
font-family: inherit;
font-weight: inherit;
}
/*subtitle_in
{
margin-left: -4px;
margin-bottom: 8px;
margin-top: 16px;
text-shadow: 0 0 1px #111111;
display: inline-block;
font-weight: bold;
}*/
code
{
background: #EEEEEE;
display: inline-block;
padding: 1px;
font-family: "courier new", monospace !important;
}
ul
{
margin-left: 32px;
margin-top: 4px;
margin-bottom: 4px;
}
/*h1
{
height: 1px;
background: transparent;
font-size:0px;
font-weight:normal;
padding:0px;
color: transparent;
}
h1 em
{
font-style:normal;
}*/
#content
{
/*width: 916px; /* 1111 */
float: left;
margin: 0px;
margin-left: 12px;
margin-right: 12px;
width: 976px;
}
h3
{
font-size: 24px;
border-bottom: 2px solid #666666;
}
.category
{
font-size: 18px;
margin: 15px 0 0 20px;
}
ph
{
padding: 0px;
margin-left: -1px;
margin-top: 0px;
}
h5
{
font-size: 12px;
margin: 10px 10px 25px 50px;
line-height: 20px;
border-left: 3px solid #ffffff;
padding-left: 13px;
}
.post
{
display: inline-block;
font-size: 16px;
line-height: 25px !important;
margin-top: 5px;
margin-bottom: 10px;
margin-left: 16px;
margin-right: 16px;
line-height: 20px;
font-weight: 1;
background-color: transparent;
background-image: URL(images/PostBKG.png);
background-repeat: repeat;
padding: 15px;
width: 914px;
text-align: justify;
}
.pagesplit
{
height: 20px;
width: 904px;
background: transparent URL(images/postbreak.png);
margin-top: 16px;
margin-bottom: 10px;
margin-left: auto;
margin-right: auto;
}
.summaryblock
{
width: 440px;
display: inline-block;
vertical-align: top;
margin-left: 8px;
margin-right: 8px;
height: 275px !important;
overflow-x: visible;
overflow-y: hidden;
}
.summaryblock:hover
{
cursor: pointer;
/*color: #000099;*/
}
.summaryblock a
{
text-decoration: none;
color: inherit;
}
.summaryblock a:hover
{
text-decoration: none;
}
.imgleft
{
border-radius: 5px;
box-shadow: 2px 2px 5px #888888;
float: left;
margin-right: 16px;
margin-top: 2px;
margin-bottom: 8px;
margin-left: 0px;
}
.imgleft_noborder
{
float: left;
margin-right: 16px;
margin-top: 2px;
margin-bottom: 8px;
margin-left: 0px;
}
.imgright
{
border-radius: 5px;
box-shadow: 2px 2px 5px #888888;
float: right;
margin-right: 0px;
margin-top: 2px;
margin-bottom: 8px;
margin-left: 16px;
}
.imgright_noborder
{
float: right;
margin-right: 0px;
margin-top: 2px;
margin-bottom: 8px;
margin-left: 16px;
}
.imgnormal
{
border-radius: 5px;
box-shadow: 2px 2px 5px #888888;
}
.rounded
{
border-radius: 16px;
}
/* Css Effect8 box shadow */
.elegant
{
position:relative;
-webkit-box-shadow:0 1px 4px #000000, 0 0 40px #000000 inset;
-moz-box-shadow:0 1px 4px #000000, 0 0 40px #000000 inset;
box-shadow:0 1px 4px #000000, 0 0 40px #000000 inset;
}
/*#comment
{
margin-left: 32px;
margin-right: 32px;
padding: 8px;
border-radius: 5px;
border: 1px solid #5555ee;
}*/
/* COMMENTS */
.comment
{
color: #000000;
font: 16px "Trebuchet MS", Helvetica, sans-serif;
/*line-height:24px;*/
padding: 15px;
background-color: #f2f2f2;/*#e8e7e2;*/
border: 1px solid #c2c2c2;
-moz-border-radius: 5px; /* Firefox 3.6-, removed in Firefox 13 */
-webkit-border-radius: 5px; /* Safari 4-, Chrome 3- */
border-radius: 5px; /* Firefox 4+, Safari 5+, Chrome 4+, Opera 10.5+, IE9+ */
width: auto%;
margin-right: 32px;
margin-left: 32px;
}
.com_report
{
float: right;
}
.com_title_text
{
font-size:19px;
/*text-transform:capitalize;*/
color: #000000;
}
.com_title
{
padding: 5px;
margin-right: -15px;
padding-left: 10px;
background-color: #ffffff;
margin-left: -15px;
margin-top: -15px;
-moz-border-radius: 5px; /* Firefox 3.6-, removed in Firefox 13 */
-webkit-border-radius: 5px; /* Safari 4-, Chrome 3- */
border-top-right-radius: 5px; /* Firefox 4+, Safari 5+, Chrome 4+, Opera 10.5+, IE9+ */
border-top-left-radius: 5px; /* Firefox 4+, Safari 5+, Chrome 4+, Opera 10.5+, IE9+ */
border-bottom: 1px solid #e2e2e2;
width: auto;
}
.com_body
{
margin: 0 auto;
margin-top: 15px;
font: 'lucida grande',tahoma,verdana,arial,sans-serif;
font-size: 15px;
line-height: 21px;
}
.post r
{
color: #2554C7;
font-style: bold;
/*text-shadow: 0.1em 0.1em 0.2em black*/
}
.post span
{
display:block;
text-align:center;
}
.post form
{
display:block;
text-align:left;
}
.post table
{
display:block-inline;
border-collapse: collapse;
border: 2px solid #DDDDDD;
margin-left: 16px;
margin-right: 16px;
}
.post table caption
{
text-align: center;
font-size: 18px;
font-weight: bold;
margin-top: 3px;
}
.post td
{
border: 1px solid #DDDDDD;
padding: 5px;
font-size: 16px;
font-weight: normal;
}
.post th
{
border: 1px solid #DDDDDD;
padding: 5px;
font-weight: bold;
text-align: center;
background-color: #EEEEEE;
font-size: 16px;
}
input.myButton
{
background-image: url('images/formbutton.png');
width: 200px;
height: 48px;
border-style:none;
font-size: 20px;
color: #ffffff;
}
input.myButton:hover{
background-image: url('images/formbutton_hover.png');
}
input.myButton:active{
background-image: url('images/formbutton_press.png');
}
.cap
{
font-style: italic;
color: #666666;
display: block;
text-align: center;
}
#full_citation
{
display: none;
}
#full_citation_link
{
display: inline;
}
/* Footer */
footer
{
height: auto;
margin-left:auto;
margin-right:auto;
margin-bottom: 16px;
/*background: #000000;*/
background: transparent;
font-size: 12px;
/*color: #fff;*/
width: 984px;
border-radius: 8px;
text-align: center;
padding: 8px;
}
footer a
{
color: #FFF;
}
<!DOCTYPE html>
<body>
<!-- Header -->
<div id="container" class="clearfix">
<div class="nav">
<ul>
<li>Home
</li><li>Tech
<ul>
<li>Subject 1</li>
<li>Subject 2
<ul>
<li>An Item</li>
<li>Some Other Item</li>
<li>And Yet Another!</li>
<li>I Am Running Out of Ideas
<ul>
<li>Even More To Show Expansion</li>
<li>And More</li>
<li>And More!</li>
</ul>
</li>
<li>One Last Item</li>
</ul>
</li>
<li>Subject 3</li>
<li>Subject 4</li>
</ul>
</li><li>Personal
<ul>
<li>Subject 1
<ul>
<li>1111</li>
<li>2222</li>
<li>3333</li>
<li>4444
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>5555</li>
</ul>
</li>
<li>Subject 2</li>
<li>Subject 3</li>
</ul>
</li><li>Software
<ul>
<li>Subject 1</li>
<li>Subject 2</li>
<li>Subject 3</li>
</ul>
</li><li>Contact
<ul>
<li>Subject 1</li>
<li>Subject 2</li>
<li>Subject 3</li>
</ul>
</li>
</ul>
</div>
<div class="announcement">
<p>
<b>News - </b> Incredibly exciting news goes here!
</p>
</div>
<div id="pagecategory">Test Pages</div>
<div class='header' style="width: 1000px; height: 168px; background: #999999 url('http://www.bitfracture.com/images/header.png') 100% 100% no-repeat;') 100% 100% no-repeat; "></div>
<br/>
<div id="content">
<div class="post">
<h1>Test Page</h1>
Notice that when hovering over "Tech" and opening any sub-menu, all parent menus resize to the size of the sub-menu.<br/><br/>
Also notice that when hovering over "Personal" all sub-menus are now float as far left as the width of the parent, rather than their own width, leaving a gap. <br/><br/>
</div>
</div>
</div>
<footer>
© 2008-2015 Erik Greif All Rights Reserved. <br>Site design and content created by Erik Greif.
</footer>
</body>
</html>

Strange Display Artifacts when using Media Query in CSS

I am testing a pages CSS by wrapping it in a media query.
#media screen and (min-width: 1200px)
If I don't wrap the CSS in the media query everything looks fine. If I do wrap it, 99% looks fine, but on some of my list items the formatting gets weird. Little dots appear as if I had set a list style, but I didn't. If I mouse over the li, the formatting clears up.
This doesn't happen if I don't add the media query. I'm trying to work formatting for a large and small screen, and am trying to get the large screen portion operational.
Here is a snippet of the code. I set it to use a min width of 600, since that was what would work in JFiddle. If you run this code as is, and then hover over the Sports, you'll notice some weird artifacts on the tabs. Move the cursor and the artifacts disappear. If you remove the encapsulating #media query the artifacts don't appear at all.
#media screen and (min-width: 600px) {
* {
margin: 0;
padding: 0;
}
body {
font: 300 15px/1.5"Helvetica Neue", helvetica, arial, sans-serif;
background: #FFF;
margin: 15px;
color: #000;
font-family: Arial, Helvetica, sans-serif;
font-size: small;
font-style: normal;
background-color: #fff;
border: 0;
}
#navigation {
width: auto;
margin: 0;
padding: 0;
border: 0;
clear: both;
}
#column_l {
position: relative;
float: left;
}
#column_r {
float: left;
}
#footer {
width: auto;
clear: both;
overflow: auto;
}
.float_right {
float: right;
}
article {
width: 100%;
margin: 0 auto;
background: #0047FF;
color: #fff;
border-radius: 5px;
box-shadow: 0 0 15px 2px #666;
}
article P {
background: #0047FF;
}
img {
max-width: 100%;
max-height: 100%;
}
section {
clear: left;
}
#main_content {
padding: 60px;
}
p {
margin: 15px 0;
}
#container {
width: 100%;
margin: 0;
background-color: #fff;
position: relative;
padding: 0;
}
#masthead {
text-align: right;
width: 100%;
background-color: #c5d5e5;
margin: 0;
padding: 0;
overflow: auto;
}
#page_content {
position: relative;
width: 98%;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #CCAA77;
left: 20px;
}
/* Styles for Footer */
#footer p {
font-size: x-small;
text-align: center;
color: #393939;
margin: 10px;
padding: 1px;
}
#footer a {
color: #393939;
text-decoration: underline;
}
#footer a:hover {
color: #000;
text-decoration: none;
}
#footer {
background-color: #dfcfbf;
padding-bottom: 5px;
}
/* Styles for Masthead */
#masthead img {
float: left;
margin: 0;
padding: 0;
}
#masthead p {
font-size: small;
text-align: right;
color: #000;
margin: 0 0 0 0;
padding: 0;
}
/* Styles for Navigationcommon */
#navigationcommon {
background-color: #548EBE;
overflow: hidden;
}
#navigationcommon ul {
list-style-type: none;
width: 100%;
margin: 0;
padding: 0;
}
#navigationcommon li {
float: left;
}
#navigationcommon a {
color: #FFF;
text-decoration: none;
display: block;
padding: 5px;
border: 1px solid #D3D3D3;
background-color: #548EBE;
}
#navigationcommon a:hover {
color: #000;
text-decoration: none;
border: 1px solid #D3D3D3;
background-color: #ADD8E6;
}
/*Menu Color Classes*/
.green {
background: #6AA63B;
}
.yellow {
background: #FFFF00;
}
.red {
background: #CC6666;
}
.purple {
background: #CC99FF;
}
.siteblue {
background: #0047FF;
}
.blue {
background: #0292C0;
}
.purplered {
background: #66FFFF;
}
.yellowgreen {
background: #99FF33;
}
.orange {
background: #FF9900;
}
.bluegrey {
background: #669999;
}
/**
* horizontal navigation (SO)
*/
/* Targeting both first and second level menus */
#nav {
position: relative;
font-size: 13px;
}
#nav li {
list-style: none;
float: left;
}
#nav li a {
display: block;
padding: 8px 6px;
text-decoration: none;
}
#nav li a:hover {
background-color: red;
color: #FFF;
opacity: 1;
-webkit-border-top-left-radius: 30px 15px;
border-top-left-radius: 30px 15px;
-webkit-border-top-right-radius: 30px 15px;
border-top-right-radius: 30px 15px;
}
/* Targeting the first level menu */
#nav {
top: 158px;
min-width: 100%;
display: block;
height: 36px;
z-index: 1000;
position: absolute;
color: black;
background: url('images/sscbanner.png') 50% 50%;
}
#nav > li > a {} #nav a {
color: black;
}
/*added by me */
#nav li:hover {
background-color: red;
color: #FFF;
opacity: 1;
}
/*added by me */
#nav li {
max-width: 150px;
background-color: #CCCCCC;
-webkit-border-top-left-radius: 30px 15px;
border-top-left-radius: 30px 15px;
-webkit-border-top-right-radius: 30px 15px;
border-top-right-radius: 30px 15px;
list-style: none;
/*-webkit-border-radius: 30px 30px 0px 0px;
border-radius: 30px 30px 0px 0px;*/
border-left: 2px dotted black;
}
/* Targeting the second level menu */
#nav li ul {
color: black;
display: none;
position: absolute;
min-width: 100%;
background-color: #0047FF;
}
#nav li ul li {
display: inline;
/*added by me
line-height: 50px;*/
margin: 0;
padding: 10px 4px 0 4px;
color: black;
height: 50px;
text-align: center;
max-width: 150px;
background-color: #CCCCCC;
border-left: 2px dotted black;
list-style: none;
}
/*this is hitting all of the a elements */
#nav li ul li a {
border: none;
/*line-height: 50px;*/
margin: 0;
padding: 0 4px 0 4px;
color: black;
}
#nav li ul li a:hover {
background-color: red;
color: #FFF;
opacity: 1;
-webkit-border-top-left-radius: 30px 15px;
border-top-left-radius: 30px 15px;
-webkit-border-top-right-radius: 30px 15px;
border-top-right-radius: 30px 15px;
}
/* Third level menu */
#nav li ul li ul {
top: 0;
min-width: 100%;
}
ul.child {
background-color: #FFF;
}
/* A class of current will be added via jQuery */
#nav li.current > a {
background: #f7f7f7;
float: left;
}
/* CSS fallback */
#nav li:hover > ul.child {
left: 0;
top: 34px;
display: inline;
position: absolute;
text-align: left;
}
/*added by me */
#nav ul > li:hover > ul.child {
left: 0;
top: 50px;
display: inline;
position: absolute;
text-align: left;
}
#nav li:hover > ul.grandchild {
display: block;
}
.linktable {
border-spacing: 0;
table-layout: fixed;
border: thick;
border-style: solid;
}
#nav .linkul {
width: 500px;
}
#nav .linkrow {
height: 50px;
}
#nav .linkcell {
padding: 0px;
border: thin;
border-style: solid;
margin: 0px;
font-size: 12px;
width: 100px;
background-color: #FFFF66;
text-align: center;
}
#nav .nonlinkcell {
padding: 0px;
border: thin;
border-style: solid;
margin: 0px;
font-size: 12px;
width: 100px;
text-align: center;
}
#nav .tablelink {
padding: 0px 0px 0px 0px;
margin: 0px;
font-size: 12px;
text-align: center;
background-color: #FFFF66;
line-height: inherit
}
#nav li ul li ul table tr td {
line-height: 12px;
}
#nav li ul li ul table tr td a:hover {
background-color: #FFFF66;
color: red;
opacity: 1;
}
#nav ul li:first-of-type {
-webkit-border-top-left-radius: 30px 15px;
border-top-left-radius: 30px 15px;
-webkit-border-top-right-radius: 30px 15px;
border-top-right-radius: 30px 15px;
}
#nav ul li ul li:first-of-type {
-webkit-border-top-left-radius: 30px 15px;
border-top-left-radius: 30px 15px;
-webkit-border-top-right-radius: 30px 15px;
border-top-right-radius: 30px 15px;
}
#nav ul li:last-of-type {
-webkit-border-top-left-radius: 30px 15px;
border-top-left-radius: 30px 15px;
-webkit-border-top-right-radius: 30px 15px;
border-top-right-radius: 30px 15px;
}
#nav ul li:first-of-type {
border-left: none;
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:mso="urn:schemas-microsoft-com:office:office">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<title>My Testing Page Issue</title>
<meta name="author" content="Me" />
<style>
</style>
<script type="text/javascript">
</script>
<meta name="processowner" content="Me" />
<script type="text/javascript">
</script>
</head>
<body>
<div id="container">
<article onclick="">
<ul id="nav">
<li><a id="close" href="" onclick="showiframe(this.id); return false;">Fruit</a>
<ul class="child">
<li>
<a id="fruit" href="" onclick="showiframe(this.id); return false;">
<br />About</a>
</li>
<li>Oranges</li>
<li>
<br />Grapes</li>
<li>
<br />Apples</li>
<li>
<br />Bananas</li>
<li>
<br />Pears</li>
</ul>
</li>
<li><a id="close0" href="" onclick="showiframe(this.id); return false;">Sports</a>
<ul class="child">
<li>
<a id="sports" href="" onclick="showiframe(this.id); return false;">
<br />About</a>
</li>
<li>
<br />Hockey</li>
<li>Professional
<br />Soccer</li>
<li>Professional <br /> Football
<ul class="child">
<table class="linktable blue">
<tr class="linkrow blue">
<td class="linkcell blue">Miami Dolphins
</td>
</tr>
</table>
</ul>
</li>
<li>
<br />Tennis</li>
<li>
<a href="#">
<br />Bowling</a>
</li>
<li>
<a href="#">
<br />NASCAR</a>
</li>
<li>
<a href="#">
<br />Swimming</a>
</li>
<li>
<a href="#">
<br />Fishing</a>
<ul class="child">
<table class="linktable blue">
<tr class="linkrow blue">
<td class="linkcell blue">Fly Fishing
</td>
</tr>
</table>
</ul>
</li>
<li>Olympics
</li>
<li>Baseball
<ul class="child">
<table class="linktable blue">
<tr class="linkrow blue">
<td class="nonlinkcell blue">NY Mets</td>
<td class="linkcell blue"><a class="tablelink" href="">Boston Redsox</a>
</td>
<td class="nonlinkcell blue">Los Angeles Dodgers</td>
<td class="nonlinkcell blue">New York Yankees</td>
<td class="linkcell blue"><a class="tablelink" href="">San Diego Padres</a>
</td>
<td class="linkcell blue"><a class="tablelink" href="">Cincinatti Reds</a>
</td>
<td class="linkcell blue"><a class="tablelink" href="">San Francisco Giants</a>
</td>
<td class="nonlinkcell blue"></td>
<td class="nonlinkcell blue"></td>
<td class="nonlinkcell blue"></td>
</tr>
</table>
</ul>
</li>
</ul>
</li>
</ul>
</article>
</div>
</body>
</html>

Image as bullet points

So, I'm just making a mock webpage (HTML & CSS), but when I used the background-image attribute, it gets misaligned.
Here's a snapshot of what it looks like (added the green border around the ul for the div, #watchlisten):
Here is my HTML code:
<div id="watchlisten">
<h2>Watch/Listen</h2>
<img class="boxesimg" src="images/boxes.png" alt="boxes" />
<div class="break"></div>
<img class="leftarrow" src="images/leftarrowbutton.png" alt="leftarrow" />
<div class="wlblock">
<img src="images/leftimage.png" />
<p>Titanic letter could fetch £100,000</p>
</div> <!-- watchlistenblock div -->
<div class="wlblock">
<img src="images/rightimage.png" />
<p>Cameron defends "Muppet" remark</p>
</div> <!-- watchlistenblock div -->
<img class="rightarrow" src="images/rightarrowbutton.png" alt="rightarrow" />
<ul>
<li>Sentence 1</li>
<li>Sentence 2</li>
<li>Sentence 3</li>
</ul>
</div> <!-- watchlisten div -->
And here is my CSS:
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
#topbar {
background-color:#7A0000;
width: 100%;
height: 45px;
color: #FFFFFF;
}
.fixedwidth {
width: 1050px;
margin: 0 auto;
/* background-color: green; */
}
/* BBC Logo */
#logodiv {
padding-top: 8px;
float: left;
border-right: 1px solid #990000;
padding-right: 15px;
}
/* Sign In Text */
#signindiv {
font-weight: bold;
font-size: 0.9em;
float: left;
padding: 5px 50px 8px 8px;
border-right: 1px solid #990000;
}
/* Sign In Image */
#signindiv img {
position: relative;
float: left;
margin: 6px 0 0 2px;
}
#signindiv p {
float: left;
margin: 10px 0 0 4px;
}
#topmenudiv {
float: left;
}
#topmenudiv ul {
float: left;
margin: 0;
padding: 0;
}
#topmenudiv li {
list-style-type: none;
font-weight: bold;
font-size: 0.9em;
border-right: 1px solid #990000;
height: 100%;
padding: 15px 20px 10px 20px;
text-align: center;
float: left;
}
#searchdiv {
float: left;
padding: 7px 0 0 8px;
}
#searchdiv input {
height: 25px;
border: none;
font-size: 0.9em;
padding-left: 5px;
padding-right: 22px;
background-image:url('images/magnifyglass.png');
background-repeat: no-repeat;
background-position: right center;
}
/* Clears all float attributes */
.break {
clear: both;
}
#newsbar {
background-color:#990000;
width: 100%;
height: 100px;
color: #FFFFFF;
}
#newsbar p {
margin: 10px 0 0 0;
padding: 0;
padding-top: 10px;
float: left;
}
#newsheader {
font-size: 3em;
}
#uk {
font-size: 0.7em;
padding-left: 20px;
}
#rss {
float: right;
margin-top: 38px;
}
#rss img {
height: 13px;
padding-right: 16px;
}
/* Topics Menu: Home, World, UK, England, N. Ireland, etc. */
#topicmenu {
padding-right: 16px;
}
#topicmenu ul {
background-color: #3E0C0D;
padding: 5px 0 0 5px;
margin: 0;
height: 20px;
}
#topicmenu li {
list-style-type: none;
font-size: 0.8em;
border-right: 1px solid #990000;
padding: 0 6px 0 6px;
float: left;
text-align: center;
background-color: none;
}
/* UK Tab: Grey; */
.selected {
background-color: #EDEDED;
color: #666666;
height: 20px;
position: relative;
top: -4px;
padding-top: 4px !important;
}
/* Content DIV */
#content {
width: 100%;
color: #535353;
font-size: 0.75em;
}
/* 2 April 2014 Last updated 15:23 */
#content p {
margin-right: 16px;
}
/* 2 April 2014 */
.date {
font-weight: bold;
}
/* Headline: Pollution to spread across England */
h1 {
color: #1F4F82;
font-size: 2.5em;
}
/* Headline Image */
.headlineimg {
height: 220px;
float: left;
}
/* Content div with paragraph and 4 links */
.newsitem {
position: relative;
left: 10px;
top: -15px;
width: 280px;
float: left;
font-size: 1.1em;
}
/* Link with color and no underline */
.newsitem a {
color: #1F4F82;
}
/* All anchor links have no underline */
a {
text-decoration: none;
}
/* Links have underline when hovered */
a:hover {
text-decoration: underline;
}
/* Play button next to Links */
.video {
background-image:url("images/playbutton.png");
background-repeat: no-repeat;
background-position: left center;
padding-left: 20px;
}
/* line heights for 4 links */
.linkheight {
line-height: 1.6em;
}
/* sound image */
.sound {
background-image:url("images/soundbutton.png");
background-repeat: no-repeat;
background-position: left center;
padding-left: 20px;
}
/* Watch/Listen DIV */
#watchlisten {
background-color: #EEEEEE;
float: right;
width: 367px;
position: relative;
top: -80px;
right: 17px;
}
/* Watch/Listen H2 */
h2 {
color:#505050;
position: relative;
margin: 0;
padding-top: 10px;
padding-left: 10px;
font-size: 1.8em;
}
/* 4 boxes (one orange) image */
.boxesimg {
float: right;
position: relative;
top: -14px;
right: 10px;
}
/* left arrow image (WATCH/LOOK) */
.leftarrow {
float: left;
border-right: 1px solid white;
height: 134px;
}
/* Orange Div with words in them */
.wlblock {
float: left;
background-color: #D1700E;
width: 157px;
border-right: 1px solid white;
}
/* a tag in class wlblock, made to be clickable */
.wlblock a {
color: white;
}
/*P tag in class wlblock */
.wlblock p {
margin: 9px 10px 6.5px 10px;
}
/* right arrow image (WATCH/LOOK) */
.rightarrow {
float: left;
height: 134px;
}
#watchlisten ul {
border: 2px solid green;
position: relative;
}
#watchlisten li {
list-style-type: none;
background-image:url("images/liveimg.png");
background-repeat: no-repeat;
font-size: 1.4em;
border-bottom: ;
}
And here is my JSFiddle with HTML & CSS:
http://jsfiddle.net/bbx4xdad/
You need to add padding to the list items. The CSS code that you provided shows that the Sentence 1, Sentence 2 etc list items are not targeted. Try adding this code:
#watchlisten ul li {
padding-left: 25px;
}
Alternatively, you may try using the "list-style-image" attribute this way:
ul {
list-style-image: url('my-image.png');
}
There are two things causing you issues:
There is no padding on the list items to create space for the background image. Give them some left padding and remove the padding on ul
The left arrow has float: left and this is bringing your unordered list with it. Clear the float with #watchlistendiv ul { clear: left; }
HTML / CSS / Demo
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
#topbar {
background-color: #7A0000;
width: 100%;
height: 45px;
color: #FFFFFF;
}
.fixedwidth {
width: 1050px;
margin: 0 auto;
/* background-color: green; */
}
/* BBC Logo */
#logodiv {
padding-top: 8px;
float: left;
border-right: 1px solid #990000;
padding-right: 15px;
}
/* Sign In Text */
#signindiv {
font-weight: bold;
font-size: 0.9em;
float: left;
padding: 5px 50px 8px 8px;
border-right: 1px solid #990000;
}
/* Sign In Image */
#signindiv img {
position: relative;
float: left;
margin: 6px 0 0 2px;
}
#signindiv p {
float: left;
margin: 10px 0 0 4px;
}
#topmenudiv {
float: left;
}
#topmenudiv ul {
float: left;
margin: 0;
padding: 0;
}
#topmenudiv li {
list-style-type: none;
font-weight: bold;
font-size: 0.9em;
border-right: 1px solid #990000;
height: 100%;
padding: 15px 20px 10px 20px;
text-align: center;
float: left;
}
#searchdiv {
float: left;
padding: 7px 0 0 8px;
}
#searchdiv input {
height: 25px;
border: none;
font-size: 0.9em;
padding-left: 5px;
padding-right: 22px;
background-image: url('images/magnifyglass.png');
background-repeat: no-repeat;
background-position: right center;
}
/* Clears all float attributes */
.break {
clear: both;
}
#newsbar {
background-color: #990000;
width: 100%;
height: 100px;
color: #FFFFFF;
}
#newsbar p {
margin: 10px 0 0 0;
padding: 0;
padding-top: 10px;
float: left;
}
#newsheader {
font-size: 3em;
}
#uk {
font-size: 0.7em;
padding-left: 20px;
}
#rss {
float: right;
margin-top: 38px;
}
#rss img {
height: 13px;
padding-right: 16px;
}
/* Topics Menu: Home, World, UK, England, N. Ireland, etc. */
#topicmenu {
padding-right: 16px;
}
#topicmenu ul {
background-color: #3E0C0D;
padding: 5px 0 0 5px;
margin: 0;
height: 20px;
}
#topicmenu li {
list-style-type: none;
font-size: 0.8em;
border-right: 1px solid #990000;
padding: 0 6px 0 6px;
float: left;
text-align: center;
background-color: none;
}
/* UK Tab: Grey; */
.selected {
background-color: #EDEDED;
color: #666666;
height: 20px;
position: relative;
top: -4px;
padding-top: 4px !important;
}
/* Content DIV */
#content {
width: 100%;
color: #535353;
font-size: 0.75em;
}
/* 2 April 2014 Last updated 15:23 */
#content p {
margin-right: 16px;
}
/* 2 April 2014 */
.date {
font-weight: bold;
}
/* Headline: Pollution to spread across England */
h1 {
color: #1F4F82;
font-size: 2.5em;
}
/* Headline Image */
.headlineimg {
height: 220px;
float: left;
}
/* Content div with paragraph and 4 links */
.newsitem {
position: relative;
left: 10px;
top: -15px;
width: 280px;
float: left;
font-size: 1.1em;
}
/* Link with color and no underline */
.newsitem a {
color: #1F4F82;
}
/* All anchor links have no underline */
a {
text-decoration: none;
}
/* Links have underline when hovered */
a:hover {
text-decoration: underline;
}
/* Play button next to Links */
.video {
background-image: url("images/playbutton.png");
background-repeat: no-repeat;
background-position: left center;
padding-left: 20px;
}
/* line heights for 4 links */
.linkheight {
line-height: 1.6em;
}
/* sound image */
.sound {
background-image: url("images/soundbutton.png");
background-repeat: no-repeat;
background-position: left center;
padding-left: 20px;
}
/* Watch/Listen DIV */
#watchlisten {
background-color: #EEEEEE;
float: right;
width: 367px;
position: relative;
top: -80px;
right: 17px;
}
/* Watch/Listen H2 */
h2 {
color: #505050;
position: relative;
margin: 0;
padding-top: 10px;
padding-left: 10px;
font-size: 1.8em;
}
/* 4 boxes (one orange) image */
.boxesimg {
float: right;
position: relative;
top: -14px;
right: 10px;
}
/* left arrow image (WATCH/LOOK) */
.leftarrow {
float: left;
border-right: 1px solid white;
height: 134px;
}
/* Orange Div with words in them */
.wlblock {
float: left;
background-color: #D1700E;
width: 157px;
border-right: 1px solid white;
}
/* a tag in class wlblock, made to be clickable */
.wlblock a {
color: white;
}
/*P tag in class wlblock */
.wlblock p {
margin: 9px 10px 6.5px 10px;
}
/* right arrow image (WATCH/LOOK) */
.rightarrow {
float: left;
height: 134px;
}
#watchlistendiv ul {
border: 2px solid green;
position: relative;
clear: left;
padding: 0;
}
#watchlistendiv li {
list-style-type: none;
background-image: url("http://www.placehold.it/50");
background-repeat: no-repeat;
padding-left: 50px;
font-size: 1.4em;
}
<div id="content">
<!-- newsitem -->
<div id="watchlisten">
<h2>Watch/Listen</h2>
<img class="boxesimg" src="images/boxes.png" alt="boxes" />
<div class="break"></div>
<img class="leftarrow" src="images/leftarrowbutton.png" alt="leftarrow" />
<div class="wlblock">
<img src="images/leftimage.png" />
<p>Titanic letter could fetch £100,000
</p>
</div>
<!-- watchlistenblock div -->
<div class="wlblock">
<img src="images/rightimage.png" />
<p>Cameron defends "Muppet" remark
</p>
</div>
<!-- watchlistenblock div -->
<img class="rightarrow" src="images/rightarrowbutton.png" alt="rightarrow" />
<div id="watchlistendiv">
<ul>
<li>Sentence 1
</li>
<li>Sentence 2
</li>
<li>Sentence 3
</li>
</ul>
</div>
</div>
<!-- watchlisten div -->
</div>
<!-- fixedwidth -->
</div>
<!-- content -->
</div>
<!-- topbar -->
</div>
<!-- container -->