CSS Rollover Button Issue - html

I'm trying to make the white "Contact US" text remain active or white, while the user rolls over the button and then hovers down to the list of links. I feel like I'm just circling a very simple answer. You'll notice it turns from red to white and then back to red when you rollover the dropdown menu. How do I keep it white when you rollover the menu below it?
I'm still in the process of cleaning up the code and adjusting the button, but I stripped out all the unnecessary bits.
JSFiddle: https://jsfiddle.net/hvj675mo/6/
<style>body {
background-color: #000000;
}
.new-contact-us {
background-color: transparent;
-moz-border-radius: 9px;
-webkit-border-radius: 9px;
border-radius: 9px;
border: 2px solid #ce1818;
display: inline-block;
cursor: pointer;
font-family: Arial;
font-size: 14px;
font-weight: bold;
padding: 14px 14px;
text-decoration: none;
line-height: 10px;
color: #ce1818;
}
.new-contact-us:hover {
background-color: #ce1818;
font-family: Arial;
font-size: 14px;
font-weight: bold;
color: #ffffff;
}
.new-contact-us:active {
position: relative;
/*top:1px;*/
color: #ffffff;
background-color: #ce1818;
}
/**** START BOX DIV ****/
.new-contact-us-box {
position: relative;
display: block;
}
.new-contact-us-box:active {
color: #ffffff;
}
/**** START DROPDOWN ****/
.new-contact-us-box ul li {
padding-bottom: 10px;
font-size: 16px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #ababaa;
text-transform: none;
}
.new-contact-us-box ul li a {
color: #ce1818;
text-decoration: none;
}
.new-contact-us-box ul li a:hover {
text-decoration: underline;
}
.new-contact-us-box ul li a:active {
text-decoration: underline;
}
.container-contact {
float: left;
width: 296px;
margin 0px;
}
.new-contact-us-box ul {
padding-left: 0px;
list-style: none;
margin: 0px;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown:hover {
position: relative;
display: inline-block;
background-color: #ce1818;
color: #ffffff;
-moz-border-radius: 9px;
-webkit-border-radius: 9px;
border-radius: 9px;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #ffffff;
min-width: 160px;
padding: 12px 16px;
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
left: auto !important;
right: 0 !important;
}
</style>
<div style="width: 700px; padding-left: 600px">
<!-----WILL REMOVE THIS DIV AFTER. HERE FOR TESTING---->
<div class="new-contact-us-box dropdown">
CONTACT US
<div class="dropdown-content">
<ul style="width: 296px; left: auto !important; right: 0 !important; padding: 20px;">
<li>
<div class="container-contact">
<ul>
<li>Hello</li>
<li><img src="####" style="margin-right: 10px;">#########</li>
<li style="margin-left: 28px; margin-top: -9px"> BlAH BLAH</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
<!-----WILL REMOVE THIS DIV AFTER. HERE FOR TESTING---->

You have hover on both .new-contact-us-box and .new-contact-us. So you can change this:
.new-contact-us:hover {
background-color: #ce1818;
font-family: Arial;
font-size: 14px;
font-weight: bold;
color: #ffffff;
}
to this:
.new-contact-us-box:hover .new-contact-us {
background-color: #ce1818;
font-family: Arial;
font-size: 14px;
font-weight: bold;
color: #ffffff;
}
See demo below:
body {
background-color: #000000;
}
.new-contact-us {
background-color: transparent;
-moz-border-radius: 9px;
-webkit-border-radius: 9px;
border-radius: 9px;
border: 2px solid #ce1818;
display: inline-block;
cursor: pointer;
font-family: Arial;
font-size: 14px;
font-weight: bold;
padding: 14px 14px;
text-decoration: none;
line-height: 10px;
color: #ce1818;
}
.new-contact-us-box:hover .new-contact-us {
background-color: #ce1818;
font-family: Arial;
font-size: 14px;
font-weight: bold;
color: #ffffff;
}
.new-contact-us:active {
position: relative;
/*top:1px;*/
color: #ffffff;
background-color: #ce1818;
}
/**** START BOX DIV ****/
.new-contact-us-box {
position: relative;
display: block;
}
.new-contact-us-box:active {
color: #ffffff;
}
/**** START DROPDOWN ****/
.new-contact-us-box ul li {
padding-bottom: 10px;
font-size: 16px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #ababaa;
text-transform: none;
}
.new-contact-us-box ul li a {
color: #ce1818;
text-decoration: none;
}
.new-contact-us-box ul li a:hover {
text-decoration: underline;
}
.new-contact-us-box ul li a:active {
text-decoration: underline;
}
.container-contact {
float: left;
width: 296px;
margin 0px;
}
.new-contact-us-box ul {
padding-left: 0px;
list-style: none;
margin: 0px;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown:hover {
position: relative;
display: inline-block;
background-color: #ce1818;
color: #ffffff;
-moz-border-radius: 9px;
-webkit-border-radius: 9px;
border-radius: 9px;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #ffffff;
min-width: 160px;
padding: 12px 16px;
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
left: auto !important;
right: 0 !important;
}
</style>
<div style="width: 700px; padding-left: 600px">
<!-----WILL REMOVE THIS DIV AFTER. HERE FOR TESTING--->
<div class="new-contact-us-box dropdown">
CONTACT US
<div class="dropdown-content">
<ul style="width: 296px; left: auto !important; right: 0 !important; padding: 20px;">
<li>
<div class="container-contact">
<ul>
<li>Hello</li>
<li><img src="####" style="margin-right: 10px;">#########</li>
<li style="margin-left: 28px; margin-top: -9px"> BlAH BLAH</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
<!-----WILL REMOVE THIS DIV AFTER. HERE FOR TESTING---->

Change your CSS
.new-contact-us:hover {
background-color:#ce1818;
font-family:Arial;
font-size:14px;
font-weight:bold;
color: #ffffff;
}
to this:
.dropdown:hover .new-contact-us {
background-color:#ce1818;
font-family:Arial;
font-size:14px;
font-weight:bold;
color: #ffffff;
}

Related

Drop Down Menu Issue (position)

I need help with the drop down menus. I encounter this issue when I hover on top of the tabs with hidden drop down menus. I followed the W3Schools instructions
The W3Schools instructions asked me to use position: absolute but if I do that instead of position: relative the drop down menus won't even open.
.dropdown {
float: left;
overflow: hidden;
}
.dropdown .projects {
color: #fff39e;
border: none;
background-color: #f9fae8;
font-size: 18px;
padding: 12px;
text-decoration: none;
font-family: 'Lato', sans-serif, Helvetica;
font-weight: 900;
line-height: 25px;
margin: 0;
}
.dropdown-projects {
display: none;
position: relative;
color: #f9fae8;
background-color: #101119;
min-width: 160px;
z-index: 2;
}
.dropdown-projects a {
float: none;
color: #f9fae8;
padding: 10px;
text-decoration: none;
display: block;
text-align: left;
font-size: 16px;
font-family: 'Lato', sans-serif, Helvetica;
font-weight: 400;
line-height: 0.6;
margin: 0;
}
.dropdown-projects a:hover {
color: #fff39e !important;
}
.dropdown:hover .dropdown-projects {
display: block;
}
.dropdown .dilettante {
color: #caf5ce;
border: none;
background-color: #f9fae8;
font-size: 18px;
padding: 12px;
text-decoration: none;
font-family: 'Lato', sans-serif, Helvetica;
font-weight: 900;
line-height: 25px;
margin: 0;
}
.dropdown-dilettante {
display: none;
position: relative;
color: #f9fae8;
background-color: #101119;
min-width: 160px;
z-index: 2;
}
.dropdown-dilettante a {
float: none;
color: #f9fae8;
padding: 10px;
text-decoration: none;
display: block;
text-align: left;
font-size: 16px;
font-family: 'Lato', sans-serif, Helvetica;
font-weight: 400;
line-height: 0.6;
margin: 0;
}
.dropdown-dilettante a:hover {
color: #caf5ce !important;
}
.dropdown:hover .dropdown-dilettante {
display: block;
}
<div class="dropdown">
<button class="projects">PROJECTS</button>
<div class="dropdown-projects">
ART DIRECTION
BRANDING
GRAPHIC DESIGNS
PHOTOGRAPHY
</div>
<button class="dilettante">DILETTANTE</button>
<div class="dropdown-dilettante">
INSTAGRAM
QUOTES
PLAYLIST
GOODREADS
FILMS
</div>
</div>
In the HTML, wrap both menu items in <div class="dropdown">.
In the CSS, add position: absolute on hover.
.dropdown {
float: left;
overflow: hidden;
}
.dropdown .projects {
color: #fff39e;
border: none;
background-color: #f9fae8;
font-size: 18px;
padding: 12px;
text-decoration: none;
font-family: 'Lato', sans-serif, Helvetica;
font-weight: 900;
line-height: 25px;
margin: 0;
}
.dropdown-projects {
display: none;
position: relative;
color: #f9fae8;
background-color: #101119;
min-width: 160px;
z-index: 2;
}
.dropdown-projects a {
float: none;
color: #f9fae8;
padding: 10px;
text-decoration: none;
display: block;
text-align: left;
font-size: 16px;
font-family: 'Lato', sans-serif, Helvetica;
font-weight: 400;
line-height: 0.6;
margin: 0;
}
.dropdown-projects a:hover {
color: #fff39e !important;
}
.dropdown:hover .dropdown-projects {
display: block;
/* added */
position: absolute;
}
.dropdown .dilettante {
color: #caf5ce;
border: none;
background-color: #f9fae8;
font-size: 18px;
padding: 12px;
text-decoration: none;
font-family: 'Lato', sans-serif, Helvetica;
font-weight: 900;
line-height: 25px;
margin: 0;
}
.dropdown-dilettante {
display: none;
position: relative;
color: #f9fae8;
background-color: #101119;
min-width: 160px;
z-index: 2;
}
.dropdown-dilettante a {
float: none;
color: #f9fae8;
padding: 10px;
text-decoration: none;
display: block;
text-align: left;
font-size: 16px;
font-family: 'Lato', sans-serif, Helvetica;
font-weight: 400;
line-height: 0.6;
margin: 0;
}
.dropdown-dilettante a:hover {
color: #caf5ce !important;
}
.dropdown:hover .dropdown-dilettante {
display: block;
}
<div class="dropdown">
<button class="projects">PROJECTS</button>
<div class="dropdown-projects">
ART DIRECTION
BRANDING
GRAPHIC DESIGNS
PHOTOGRAPHY
</div>
</div>
<div class="dropdown">
<button class="dilettante">DILETTANTE</button>
<div class="dropdown-dilettante">
INSTAGRAM
QUOTES
PLAYLIST
GOODREADS
FILMS
</div>
</div>
use absolute position in you dropdown and following code for display
.projects:hover + div.dropdown-projects {
display: block;
}
.dilettante:hover + div.dropdown-dilettante {
display: block;
}
here is the working file
also your code need lots of other improvement.
Does this help? JSFiddle
You'll have to edit CSS accordingly
.navbar {
overflow: hidden;
background-color: #fff;
/* Chnage the Background */
padding: 10px;
font-size: 16px;
font-family: 'Lato', sans-serif, Helvetica;
line-height: 0.6;
}
.navbar a {
float: left;
font-size: 16px;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.dropdown {
float: left;
overflow: hidden;
}
.dropdown .dropbtn {
font-size: 16px;
border: none;
outline: none;
color: #FFF39E;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
font-weight: 900;
margin: 0;
}
.navbar a:hover,
.dropdown:hover .dropbtn {
background-color: transparent;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #000;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.dropdown-content a {
float: none;
color: #fff;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
#dilettante {
color: #E1F7DB !important;
}
#projects {
color: #FFF39E;
}
.dropdown-content a:hover {
background-color: #000;
color: #FFF39E;
}
#dilettantedropdown a:hover {
color: #CAF5CE;
}
.dropdown:hover .dropdown-content {
display: block;
}
<div class="navbar">
<div class="dropdown">
<button class="dropbtn" id="projects">PROJECTS</button>
<div class="dropdown-content">
ART DIRECTION
BRANDING
GRAPHIC DESIGNS
PHOTOGRAPHY
</div>
</div>
<div class="dropdown">
<button class="dropbtn " id="dilettante">DILETTANTE
</button>
<div id="dilettantedropdown" class="dropdown-content dilettante">
INSTAGRAM
QUOTES
PLAYLIST
GOODREADS
FILMS
</div>
</div>
</div>

How to centre this text in the navigation bar

I'm trying to make the links in the navigation bar go in the centre, if someone can tell me how to do this is, i'd be grateful. I have included the HTML and CSS code below.
<div class="menu">
<ul>
<li>Home</li>
<li>Home two</li>
<li>About</li>
<li>Basket</li>
<div class="clear"></div>
</ul>
<div class="clear"></div>
</div>
.menu {
width: 100%;
background: url('img/menu-bg.png') repeat-x;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
height: auto;
display: block;
margin-top: 10px;
font-family: BentonSansBook, sans-serif;
position: relative;
padding: 10px;
display: block;
z-index: 10;
font-family: BentonSansBook, sans-serif;
-webkit-font-feature-settings: "liga" 0;
font-feature-settings: "liga" 0;
font-size: 12px;
line-height: 16px;
letter-spacing: .2em;
text-transform: uppercase;
font-weight: normal;
text-decoration: none;
cursor: pointer;
color: #000;
}
}
.menu ul {
list-style: none;
margin: 0;
}
.menu ul li {
list-style: none;
float: left;
display: block;
}
.menu ul li a {
color: #000;
display: block;
text-decoration: none;
font-weight: 700;
padding: 10px 15px;
text-transform: uppercase;
}
.menu ul li a:hover {
color: #fff;
background: #5d4442;
}
I think more useful CSS is:
.menu {
position: relative;
width: 100%;
margin-top: 10px;
padding: 10px;
background: url('img/menu-bg.png') repeat-x;
border-radius: 5px;
z-index: 10;
font: 400 12px/16px BentonSansBook, sans-serif;
-webkit-font-feature-settings: "liga" 0;
font-feature-settings: "liga" 0;
letter-spacing: .2em;
cursor: pointer;
}
.menu ul {
margin: 0;
display: flex;
flex-wrap: nowrap;
justify-content: center;
list-style: none;
}
.menu ul li a {
padding: 10px 15px;
font-weight: 700;
text-decoration: none;
text-transform: uppercase;
color: #000;
}
.menu ul li a:hover {
background: #5d4442;
color: #fff;
}
And delete CLEARFIX in html.

the text decoration wont work? in html/css

ok so i put a background and blocks in lists but now the text is hyperlinked and only the text is clickable. what am i doing wring? i need the whole box to be clickable and the text the be white until you scroll over it then it turns black. also, is there a way to make it on mobile that the boxes are closer together under each other?
body {
background: URL("https://lh3.googleusercontent.com/-lYQ3vQHE3Mo/VrVKGwg8pqI/AAAAAAAADMQ/QKjs5ALViKo/w530-d-h253-p-rw/desk%2Bbackground.png") #363634 no-repeat center top;
background-size: 100%;
background-color: #3D5771;
margin: 0;
padding: 0;
}
h1 {
position: absolute;
top: 23%;
left: 30%;
color: white;
font-family: Arial;
font-size: 4.6vw;
letter-spacing: 1px;
}
p {
position: absolute;
width: 250px;
top: -1px;
left: 15px;
height: 25px;
font-family: Arial;
}
ul {
word-spacing: .2em;
letter-spacing: .2em;
}
ul li {
font-family: Arial;
text-align: center;
vertical-align: middle;
line-height: 40px;
top: 43%;
display: inline-block;
margin-top: 250px;
margin-left: 115px;
letter-spacing: 1px;
word-spacing: normal;
background-color: rgba(5, 4, 2, 0.1);
border: 2px solid white;
color: white;
text-align: center;
text-decoration: none;
font-size: 90%;
width: 150px;
height: 40px;
}
ul li:link,
ul li:visited {
font-family: Arial;
text-align: center;
vertical-align: middle;
line-height: 40px;
display: inline-block;
margin-top: 250px;
margin-left: 115px;
letter-spacing: 1px;
word-spacing: normal;
background-color: rgba(5, 4, 2, 0.1);
border: 2px solid white;
font-size: 90%;
width: 150px;
height: 40px;
text-decoration: none;
color: white;
}
li {
text-decoration: none;
color: white;
}
ul li:hover,
ul li:active {
background-color: white;
color: black;
text-decoration: none;
}
<center>
<h1>A Girl With A Passion</h1>
</center>
<ul>
<li><strong>MY LIFE</strong>
</li>
<li><strong>PORTFOLIO</strong>
</li>
<li><strong>RESUME</strong>
</li>
<li><strong>ABOUT ME</strong>
</li>
</ul>
The text decoration is done on the anchor element I think, not the <li> tag.
Have you tried this?
ul li a,
ul li a {
text-decoration: none;
}
Full CSS/HTML:
body {
background: URL("https://lh3.googleusercontent.com/-lYQ3vQHE3Mo/VrVKGwg8pqI/AAAAAAAADMQ/QKjs5ALViKo/w530-d-h253-p-rw/desk%2Bbackground.png") #363634 no-repeat center top;
background-size: 100%;
background-color: #3D5771;
margin: 0;
padding: 0;
}
h1 {
position: absolute;
top: 23%;
left: 30%;
color: white;
font-family: Arial;
font-size: 4.6vw;
letter-spacing: 1px;
}
p {
position: absolute;
width: 250px;
top: -1px;
left: 15px;
height: 25px;
font-family: Arial;
}
ul {
word-spacing: .2em;
letter-spacing: .2em;
}
ul li {
font-family: Arial;
text-align: center;
vertical-align: middle;
line-height: 40px;
top: 43%;
display: inline-block;
margin-top: 250px;
margin-left: 115px;
letter-spacing: 1px;
word-spacing: normal;
background-color: rgba(5, 4, 2, 0.1);
border: 2px solid white;
color: white;
text-align: center;
text-decoration: none;
font-size: 90%;
width: 150px;
height: 40px;
}
ul li:link,
ul li:visited {
font-family: Arial;
text-align: center;
vertical-align: middle;
line-height: 40px;
display: inline-block;
margin-top: 250px;
margin-left: 115px;
letter-spacing: 1px;
word-spacing: normal;
background-color: rgba(5, 4, 2, 0.1);
border: 2px solid white;
font-size: 90%;
width: 150px;
height: 40px;
text-decoration: none;
color: white;
}
li {
text-decoration: none;
color: white;
}
ul li:hover,
ul li:active {
background-color: white;
color: black;
text-decoration: none;
}
ul li:hover a,
ul li a:active {
background-color: white;
color: black;
}
ul li a {
color: white;
text-decoration: none;
height: 100%;
width: 100%;
display: inline-block;
}
<center>
<h1>A Girl With A Passion</h1>
</center>
<ul>
<li><strong>MY LIFE</strong>
</li>
<li><strong>PORTFOLIO</strong>
</li>
<li><strong>RESUME</strong>
</li>
<li><strong>ABOUT ME</strong>
</li>
</ul>
Add this to your CSS to make the whole "box" clickable
ul li a {
display: inline-block;
height: 100%;
width: 100%;
color: white;
text-decoration: none;
}
And change this to get color right
ul li a:hover, ul li a:active {
background-color: white;
color: black;
}
Update: Base on your request, I made some markup changes, to make it more responsive
Snippet demo
html, body {
margin: 0;
padding:0;
}
body {
background:URL("https://lh3.googleusercontent.com/-lYQ3vQHE3Mo/VrVKGwg8pqI/AAAAAAAADMQ/QKjs5ALViKo/w530-d-h253-p-rw/desk%2Bbackground.png") #363634 no-repeat center top;
background-size: 100%;
background-color:#3D5771;
}
.wrapper {
padding-top: 10%;
}
h1 {
color: white;
font-family:Arial;
font-size: 4.6vw;
letter-spacing: 1px;
text-align: center;
}
ul {
word-spacing: .2em;
letter-spacing: .2em;
text-align: center;
margin: 0;
padding: 0;
}
ul li {
font-family:Arial;
text-align: center;
vertical-align: middle;
line-height: 40px;
display: inline-block;
background-color: rgba(5,4,2,0.1);
border: 2px solid white;
color: white;
font-size: 90%;
width: 150px;
height: 40px;
margin: 30px;
}
ul li a:hover, ul li a:active {
background-color: white;
color: black;
}
ul li a {
display: inline-block;
height: 100%;
width: 100%;
text-decoration: none;
color: white;
}
#media screen and (max-width: 700px) {
.wrapper {
padding-top: 5%;
}
ul li {
margin: 10px;
}
}
<div class="wrapper">
<h1>A Girl With A Passion</h1>
<ul>
<li><a href="www.youtube.com" class="life" ><strong>MY LIFE</strong></a></li>
<li><strong>PORTFOLIO</strong></li>
<li><strong>RESUME</strong></li>
<li><strong>ABOUT ME</strong></li>
</ul>
</div>
that is because you haven't used text-decoration property for your a.to do that in your css use,
li a{
text-decoration:none;
}
instead of this.
li{
text-decoration:none;
}

How do i add a fading border to my nav bar CSS

I would like to add a line above and below my nav-bar that would fade out at the ends of it, like shown in the image below:
this is my HTML so far:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>My Portfolio - Home</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div id="header">
<h1>Alex Trotter</h1>
<ul id="nav">
<li>Home</li>
<img class="circle" title="circle" alt="circle" src="images/circle.png" />
<li>About Me</li>
<img class="circle" title="circle" alt="circle" src="images/circle.png" />
<li>Contact</li>
</ul>
</div>
<div id="content">
<div id="webInfo">
<p>Hi, my name is Alex Trotter and this is my portfolio website</p>
<p>below you will find some of work that I have created.</p>
<p>Above you can navigate to different pages to learn more about me.</p>
</div>
<div id="exampleWork1"></div>
<div id="exampleWork2"></div>
<div id="exampleWork3"></div>
</div>
</body>
And this is my CSS:
body {
display: block;
margin: 0;
padding: 0px;
}
#header {
background-color: #b9fee2;
width: 1920px;
height: 200px;
display: inline-block;
}
h1 {
font-family: Optima, Segoe, 'Segoe UI', Candara, Calibri, Arial, sans-serif;
font-size: 75px;
font-weight: 500;
text-align: center;
margin: 0px;
color: #000000;
text-decoration: none;
}
h1 a {
text-decoration: none;
}
h1 a:visited {
color: #000000;
text-decoration: none;
}
#nav {
display: inline-block;
-webkit-padding-start: 0px;
text-align: center;
margin: auto;
width: 100%;
}
#nav li {
display: inline-block;
vertical-align: top;
}
#nav a {
-webkit-transition: background-color 0.2s linear;
}
#nav a:link {
display: block;
text-align: center;
color: #000000;
text-decoration: none;
font-family: Georgia, Times, 'Times New Roman', serif;
font-size: 30px;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 50px;
padding-right: 50px;
}
#nav a:visited {
color: #000000;
}
#nav a:hover {
display: block;
text-align: center;
color: #000000;
background-color: #FFFFFF;
text-decoration: none;
padding-left: 50px;
padding-right: 50px;
font-size: 30px;
}
.circle {
padding-top: 25px;
}
Whenever I try to add a border to the nav-bar it goes across the entire screen, but if I make it so that the nav-bar border is only as big as it needs to be, the nav bar isn't in the center of the screen. What is the best way to solve this problem?
A couple of positioned pseudo-elements with a linear gradient background would be probably the simplest method.
Note: Your menu HTML is invalid, ul can only have li as direct children..not images, you can search SO for other options for menu dividers.
body {
margin: 0;
padding: 0px;
}
#header {
background-color: #b9fee2;
height: 200px;
text-align: center;
}
h1 {
font-family: Optima, Segoe, 'Segoe UI', Candara, Calibri, Arial, sans-serif;
font-size: 75px;
font-weight: 500;
text-align: center;
margin: 0px;
color: #000000;
text-decoration: none;
}
h1 a {
text-decoration: none;
}
h1 a:visited {
color: #000000;
text-decoration: none;
}
#nav {
display: inline-block;
-webkit-padding-start: 0px;
text-align: center;
margin: auto;
position: relative;
}
#nav::before,
#nav:after {
content: '';
position: absolute;
left: 0;
width: 100%;
height: 2px;
background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, .75) 50%, rgba(0, 0, 0, 0) 100%);
}
#nav::before {
top: 0;
}
#nav:after {
bottom: 0;
}
#nav li {
display: inline-block;
vertical-align: top;
}
#nav a {
-webkit-transition: background-color 0.2s linear;
}
#nav a:link {
display: block;
text-align: center;
color: #000000;
text-decoration: none;
font-family: Georgia, Times, 'Times New Roman', serif;
font-size: 30px;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 50px;
padding-right: 50px;
}
#nav a:visited {
color: #000000;
}
#nav a:hover {
display: block;
text-align: center;
color: #000000;
background-color: #FFFFFF;
text-decoration: none;
padding-left: 50px;
padding-right: 50px;
font-size: 30px;
}
<div id="header">
<h1>Alex Trotter</h1>
<ul id="nav">
<li>Home
</li>
<li>About Me
</li>
<li>Contact
</li>
</ul>
</div>
in the CSS, add a hover:
#nav {
border-top: 2px solid blue;
border-bottom: 2px solid blue;
}
#nav.noHighlight {
background:transparent;
border-color:transparent;
}
then add a jQuery script, and put
setTimeout(function(){
$('#abc').fadeIn();
$('#abc').addClass('noHighlight');
},1000);

Drop Down Being Pushed To the Right?

For some reason, my drop down menu is being pushed to the right. It's supposed to open up directly below the link someone is hovering over, but it opens about 30px to the right and I can't figure out why. You can see the issue in action when you scroll over "Work" on my website: http://www.noellesnotes.com
My code:
CSS
ul.site-navigation {
text-align: center;
list-style: none;
}
ul.site-navigation li a{
padding: 50px 0 47px 0;
font-family: 'Arvo', serif, Georgia;
width: 125px;
float: left;
letter-spacing: 4px;
text-transform: uppercase;
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
transition:.5s;
color: rgb(82,82,82);
border-bottom: 3px solid transparent;
}
ul.site-navigation > li {
position: relative;
width: 125px;
float:left;
margin: 0;
}
ul.site-navigation a:hover{
font-weight: bold;
border-bottom: 3px solid rgb(4,141,195);
text-shadow: rgb(200, 200, 200) 1px 1px 0px;
padding: 97px 0 0 0;
}
ul.site-navigation ul {
list-style: none;
height: 50px;
left: 0;
z-index: 1000;
padding: 0;
display: none;
}
ul.site-navigation ul li {
float: none;
}
ul.site-navigation li:hover ul {
display: block;
position: absolute;
top: 100%;
left: 0;
}
ul.site-navigation ul li a {
font-weight: regular;
font-size: 16px;
text-shadow: none;
padding: 5px 10px;
width: auto;
height: auto;
text-transform: uppercase;
border: 2px solid #FFF;
color: #FFF;
margin: 5px 10px 0 0;
}
ul.site-navigation ul li a:hover {
font-weight: regular;
font-size: 16px;
text-shadow: none;
padding: 5px 10px;
width: auto;
height: auto;
text-transform: uppercase;
border: 2px solid #FFF;
color: #FFF;
}
.site-title a {
color: rgb(185,40,141);
font-family: 'Arvo', serif;
text-transform: uppercase;
font-size: 63px;
background-color: rgba(255,255,255,1);
text-align: center;
text-shadow: #FFF 1px 1px,#ccc 2px 2px;
width: 500px;
float: left;
padding-top: 13px;
font-weight: normal;
letter-spacing: normal;
}
.site-branding {
display: table;
width: 100%;
height: 400px;
font-family: 'Lato', verdana, san-serif;
font-size: 6em;
text-shadow:1px -1px rgba(242,141,89,0.2);
text-align: center;
text-transform: uppercase;
color: rgb(255,255,255);
background-image: url('http://www.noellesnotes.com/wp-content/themes/portfolio/images/lights.jpg');
background-attachment:fixed;
}
HTML:
<ul class="site-navigation">
<li>About</li>
<li>Work
<ul class="submenu">
<li>Seventeen.com</li>
<li>One Direction Connection</li>
</ul>
</li>
</ul>
You have a left margin on all uls that are direct children of lis. (li > ul {margin-left:1.5em})
Add Something like this to your css to override that for your menu:
ul.site-navigation > li > ul {
margin-left:-2.75em
}
I think its natural because li tag has ul tag
You can use margin-left:-2px to fix this