I need a responsive timeline with labels under each number (JSFiddle Example):
<ul>
<li>1</li>
<li>2</li>
<li class="active">3</li>
<li>4</li>
</ul>
And the CSS is the following:
li {
width: 2em;
height: 2em;
text-align: center;
line-height: 2em;
border-radius: 1em;
background: dodgerblue;
margin: 0 1em;
display: inline-block;
color: white;
position: relative;
}
li::before{
content: '';
position: absolute;
top: .9em;
left: -4em;
width: 4em;
height: .2em;
background: dodgerblue;
z-index: -1;
}
li:first-child::before {
display: none;
}
.active {
background: dodgerblue;
}
.active ~ li {
background: lightblue;
}
.active ~ li::before {
background: lightblue;
}
How can I:
1. Make it responsive so the distance between circles change on browser resizing?
2. How to add a label under each circle?
Have a look at the jsfiddle i've done for you excuse me if i understood anything wrong ask me if you need anything.
https://jsfiddle.net/Lvxctyq1/
HTML
<section class="section intro">
<div class="container">
<h1>TIMELINE →</h1>
</div>
</section>
<section class="timeline">
<ol>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li>
<div>
<info>1943</info> In mattis elit vitae odio posuere, nec maximus massa varius. Suspendisse varius volutpat mattis. Vestibulum id magna est.
</div>
</li>
<li></li>
</ol>
</section>
CSS
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
button {
background: transparent;
border: none;
cursor: pointer;
outline: none;
}
body {
font: normal 16px/1.5 "Helvetica Neue", sans-serif;
background: #456990;
color: #fff;
}
/* .section SECTION
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.section {
background: #F45B69;
padding: 50px 0;
}
.section .container {
width: 90%;
max-width: 1200px;
margin: 0 auto;
text-align: center;
}
.section h1 {
font-size: 2.5rem;
}
.section h2 {
font-size: 1.3rem;
}
/* TIMELINE
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.timeline {
white-space: nowrap;
overflow-x: hidden;
}
.timeline ol {
font-size: 0;
width: 100vw;
padding: 250px 0;
transition: all 1s;
}
.timeline ol li {
position: relative;
display: inline-block;
list-style-type: none;
width: 160px;
height: 3px;
background: #fff;
}
.timeline ol li:last-child {
width: 280px;
}
.timeline ol li:not(:first-child) {
margin-left: 14px;
}
.timeline ol li:not(:last-child)::after {
content: '';
position: absolute;
top: 50%;
left: calc(100% + 1px);
bottom: 0;
width: 12px;
height: 12px;
transform: translateY(-50%);
border-radius: 50%;
background: #F45B69;
}
.timeline ol li div {
position: absolute;
left: calc(100% + 7px);
width: 280px;
padding: 15px;
font-size: 1rem;
white-space: normal;
color: black;
background: white;
}
.timeline ol li div::before {
content: '';
position: absolute;
top: 100%;
left: 0;
width: 0;
height: 0;
border-style: solid;
}
.timeline ol li:nth-child(odd) div {
top: -16px;
transform: translateY(-100%);
}
.timeline ol li:nth-child(odd) div::before {
top: 100%;
border-width: 8px 8px 0 0;
border-color: white transparent transparent transparent;
}
.timeline ol li:nth-child(even) div {
top: calc(100% + 16px);
}
.timeline ol li:nth-child(even) div::before {
top: -8px;
border-width: 8px 0 0 8px;
border-color: transparent transparent transparent white;
}
.timeline info {
display: block;
font-size: 1.2rem;
font-weight: bold;
margin-bottom: 8px;
}
/* GENERAL MEDIA QUERIES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
#media screen and (max-width: 599px) {
.timeline ol,
.timeline ol li {
width: auto;
}
.timeline ol {
padding: 0;
transform: none !important;
}
.timeline ol li {
display: block;
height: auto;
background: transparent;
}
.timeline ol li:first-child {
margin-top: 25px;
}
.timeline ol li:not(:first-child) {
margin-left: auto;
}
.timeline ol li div {
width: 94%;
height: auto !important;
margin: 0 auto 25px;
}
.timeline ol li div {
position: static;
}
.timeline ol li:nth-child(odd) div {
transform: none;
}
.timeline ol li:nth-child(odd) div::before,
.timeline ol li:nth-child(even) div::before {
left: 50%;
top: 100%;
transform: translateX(-50%);
border: none;
border-left: 1px solid white;
height: 25px;
}
#Baransel gave you a solution, but to answer your questions...
How can I:
1. Make it responsive so the distance between circles change on browser resizing?
Put margin or padding in the CSS for the li or as the example above in the div within the li.
How to add a label under each circle?
Either in the html as #Baransel has done through the use of an tag, or appending it via the ::after attribute in the CSS content field. Likely putting the label actually in the HTML is the best choice for accessibility.
Related
Well, there are two sections in my HTML code, and those sections have too much space between them, I mean if the screen is fully stretched out and the height is large, it has a dozen of spaces between them. Also for some reason, the second section's text is a bit further from the image.
I've also tried to set display: flex; align-items: flex-start; justify-content:center;, but it hasn't worked. So if you have any idea about this problem, please help.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'poppins', sans-serif;
}
body {
background: #343131;
}
nav {
height: 80px;
width: 100%;
background-color: #2b2d2e;
background-image: linear-gradient(62deg, #46484a 0%, #2e2e30 100%);
}
nav i {
color: #d35858;
cursor: pointer;
font-size: 40px;
padding-top: 20px;
padding-right: 20px;
float: right;
}
.nav-link {
height: 100vh;
position: fixed;
width: 100%;
background-color: rgb(42, 43, 43);
left: -100%;
top: 10%;
transition: 0.5s;
display: flex;
align-items: flex-start;
justify-content: center;
}
.nav-link a {
text-decoration: none;
color: #fff;
font-size: 30px;
display: block;
text-align: center;
font-weight: bold;
padding: -100px;
}
a:hover,
a.active {
transition: .5s;
color: rgb(239, 122, 122);
}
.nav-link ul li {
padding: 18px;
}
.nav-link ul {
list-style: none;
margin-top: 50px;
}
.nav-bar-top ul {
padding-top: 32px;
float: right;
padding-right: 80px;
}
.nav-bar-top ul li {
display: inline-block;
padding-left: 15px;
}
.nav-bar-top ul li a {
color: #d5c9c9;
text-decoration: none;
}
.nav-bar-top ul li a.active {
color: #fa9e9e;
}
.nav-bar-top ul li a:hover {
color: #d35858;
}
#about-szabi {
width: 100%;
height: 100vh;
background: #343131;
display: flex;
align-items: flex-start;
justify-content: center;
}
#about-szabi .content img {
height: auto;
width: 320px;
max-width: 100%;
}
section .content img:hover {
transform: scale(1.05);
-webkit-transform: scale(1.05);
-moz-transform: scale(1.05);
-o-transform: scale(1.05);
transition: 0.5s;
}
.text {
width: 550px;
max-width: 100%;
padding: 10px 30px;
display: grid;
place-items: center;
text-align: center;
}
.text h1 {
color: #d35858;
font-size: 40px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.text h5 {
font-size: 20px;
color: rgb(193, 183, 183);
text-align: center;
}
.text p {
color: #e6d6d6;
padding-top: 10px;
font-size: 20px;
}
.content {
width: 1280px;
max-width: 95%;
margin: 0px auto;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-around;
}
#media(min-width: 601px) {
#nav-bar-icon {
display: none;
}
}
#media(max-width: 601px) {
.nav-bar-top ul {
display: none;
}
}
<nav>
<label id="nav-bar-icon">
<i class="fa-solid fa-bars"></i>
</label>
<div class="nav-bar-top">
<ul>
<li>HOME</li>
<li><a class="active" href="info.html">ABOUT US</a></li>
<li>CONTACT</li>
<li>SERVICES</li>
<li>FEEDBACK</li>
</ul>
</div>
</nav>
<div class="nav-link">
<ul>
<li>HOME</li>
<li><a class="active" href="/">ABOUT US</a></li>
<li>CONTACT</li>
<li>SERVICES</li>
<li>FEEDBACK</li>
</ul>
</div>
<section id="about-szabi">
<div class="content">
<img draggable="false" src="../img/person.png">
<div class="text">
<h1>About Szabolcs</h1>
<h5>Programmer & Web Designer</h5>
<p>
IAliquam lobortis posuere felis, sit amet ultrices turpis suscipit in. Mauris
egestas aliquam lacus, non lobortis mi sollicitudin ut. Donec vitae est
malesuada, dapibus nisi ac, placerat felis. Cras tincidunt vehicula lorem eget
efficitur. Integer vestibulum nulla justo. Mauris efficitur viverra est, sit
amet semper orci tristique eget. Nam condimentum accumsan lectus, a efficitur
orci vestibulum a. Nulla quis dui congue leo ultricies convallis id.
</p>
</div>
</div>
</section>
<section id="about-milan">
<div class="content">
<img draggable="false" src="../img/person2.png">
<div class="text">
<h1>About Milán</h1>
<h5>Programmer & Web Designer</h5>
<p>
Donec velit ipsum, accumsan ut lectus eu, sodales hendrerit enim. Fusce ut
sapien sit amet ligula volutpat condimentum vitae in neque. In sit amet erat
et nisi interdum vestibulum. Nunc vestibulum, dolor id pellentesque dictum,
est nulla hendrerit lacus, vitae ultricies mauris ante vitae tellus. Vivamus
ac nisi at justo tempus imperdiet sed faucibus ex. Curabitur ut lectus leo. In
odio magna, aliquet id lectus in, pretium fermentum massa. Fusce eget
condimentum felis. Morbi quis diam massa.
</p>
</div>
</div>
</section>
#about-szabi {
width: 100%;
height: 100%;
background:#343131;
display: flex;
align-items: flex-start;
justify-content: center;
}
In this part, I used 100% instead of 100vh,
And I got the about-milan css in the html field with the same name as the first part.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'poppins', sans-serif;
}
body {
background:#343131;
}
nav {
height: 80px;
width: 100%;
background-color: #2b2d2e;
background-image: linear-gradient(62deg, #46484a 0%, #2e2e30 100%);
}
nav i {
color: #d35858;
cursor: pointer;
font-size: 40px;
padding-top: 20px;
padding-right: 20px;
float: right;
}
.nav-link {
height: 100vh;
position: fixed;
width: 100%;
background-color: rgb(42, 43, 43);
left: -100%;
top: 10%;
transition: 0.5s;
display: flex;
align-items: flex-start;
justify-content: center;
}
.nav-link a {
text-decoration: none;
color: #fff;
font-size: 30px;
display: block;
text-align: center;
font-weight: bold;
padding: -100px;
}
a:hover, a.active{
transition: .5s;
color: rgb(239, 122, 122);
}
.nav-link ul li {
padding: 18px;
}
.nav-link ul {
list-style: none;
margin-top: 50px;
}
.nav-bar-top ul {
padding-top: 32px;
float: right;
padding-right: 80px;
}
.nav-bar-top ul li {
display: inline-block;
padding-left: 15px;
}
.nav-bar-top ul li a {
color: #d5c9c9;
text-decoration: none;
}
.nav-bar-top ul li a.active {
color: #fa9e9e;
}
.nav-bar-top ul li a:hover {
color: #d35858;
}
/* Not default code */
#about-szabi {
width: 100%;
height: 100%;
background:#343131;
display: flex;
align-items: flex-start;
justify-content: center;
}
#about-szabi .content img {
height: auto;
width: 320px;
max-width: 100%;
}
.section .content img:hover {
transform: scale(1.05);
-webkit-transform: scale(1.05);
-moz-transform: scale(1.05);
-o-transform: scale(1.05);
transition: 0.5s;
}
.text {
width: 550px;
max-width: 100%;
padding: 10px 30px;
display: grid;
place-items: center;
text-align: center;
}
.text h1 {
color: #d35858;
font-size: 40px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.text h5 {
font-size: 20px;
color:rgb(193, 183, 183);
text-align: center;
}
.text p {
color: #e6d6d6;
padding-top: 10px;
font-size: 20px;
}
.content {
width: 1280px;
max-width: 95%;
margin: 0px auto;
display: flex;
/* sets whether flex items are forced onto one line or can wrap onto multiple lines.
If wrapping is allowed, it sets the direction that lines are stacked */
flex-wrap: wrap;
align-items: center;
justify-content: space-around;
}
#media(min-width: 601px) {
#nav-bar-icon {
display: none;
}
}
#media(max-width: 601px) {
.nav-bar-top ul {
display: none;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>About Us</title>
<link rel="stylesheet" href="../css/info.css">
<script src="https://kit.fontawesome.com/f2665b7baf.js" crossorigin="anonymous"></script>
</head>
<body>
<nav>
<label id="nav-bar-icon">
<i class="fa-solid fa-bars"></i>
</label>
<div class="nav-bar-top">
<ul>
<li>HOME</li>
<li><a class="active" href="info.html">ABOUT US</a></li>
<li>CONTACT</li>
<li>SERVICES</li>
<li>FEEDBACK</li>
</ul>
</div>
</nav>
<div class="nav-link">
<ul>
<li>HOME</li>
<li><a class="active" href="/">ABOUT US</a></li>
<li>CONTACT</li>
<li>SERVICES</li>
<li>FEEDBACK</li>
</ul>
</div>
<section id="about-szabi">
<div class="content">
<img draggable="false" src="../img/person.png">
<div class="text">
<h1>About Szabolcs</h1>
<h5>Programmer & Web Designer</h5>
<p>
IAliquam lobortis posuere felis, sit amet ultrices turpis suscipit in. Mauris
egestas aliquam lacus, non lobortis mi sollicitudin ut. Donec vitae est
malesuada, dapibus nisi ac, placerat felis. Cras tincidunt vehicula lorem eget
efficitur. Integer vestibulum nulla justo. Mauris efficitur viverra est, sit
amet semper orci tristique eget. Nam condimentum accumsan lectus, a efficitur
orci vestibulum a. Nulla quis dui congue leo ultricies convallis id.
</p>
</div>
</div>
</section>
<section id="about-szabi">
<div class="content">
<img draggable="false" src="../img/person2.png">
<div class="text">
<h1>About Milán</h1>
<h5>Programmer & Web Designer</h5>
<p>
Donec velit ipsum, accumsan ut lectus eu, sodales hendrerit enim. Fusce ut
sapien sit amet ligula volutpat condimentum vitae in neque. In sit amet erat
et nisi interdum vestibulum. Nunc vestibulum, dolor id pellentesque dictum,
est nulla hendrerit lacus, vitae ultricies mauris ante vitae tellus. Vivamus
ac nisi at justo tempus imperdiet sed faucibus ex. Curabitur ut lectus leo. In
odio magna, aliquet id lectus in, pretium fermentum massa. Fusce eget
condimentum felis. Morbi quis diam massa.
</p>
</div>
</div>
</section>
<script src="../js/index.js"></script>
Hello, I have a solution for two problems,
You just have to take a look at a .section .content img:hover field for the image to be responsive.
I have an aside section that I'd like to have centered using a media query, so that once it's viewed on a mobile, it'll be at the bottom of the page aligned horizontally. Just like this:
This is what it's currently doing:
I have some images and text I don't want to share so I'll change them for this question...
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
line-height: 1.5;
padding: 0;
margin: 0;
background-color: white;
}
/*GLOBAL*/
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
header ul {
padding: 0;
margin: 0;
}
.page-title {
font-size: 20px;
}
.page-title-center {
font-size: 20px;
text-align: center;
}
.subheading-center {
font-size: 15px;
text-align: center;
margin-top: 50px;
}
.dark {
padding: 15px;
background: #1CAC4B;
color: white;
margin-top: 10px;
margin-bottom: 10px;
}
.dark-center {
padding: 15px;
text-align: center;
background: #1CAC4B;
color: white;
margin: 10px;
}
#hyperlink {
color: #FFEE00;
}
#hyperlinkg {
color: #1CAC4B;
}
/*HEADER*/
header {
background: #1CAC4B;
color: #fff;
padding-top: 30px;
min-height: 70px;
border-bottom: #FFEE00 3px solid;
display: flex;
}
header a {
color: #fff;
text-decoration: none;
text-transform: uppercase;
font-size: 15px;
}
header li {
float: left;
display: inline;
padding: 0 10px 0 10px;
}
header #branding {
float: left;
}
header #branding-img img {
float: left;
width: 60px;
height: 60px;
padding: 0 20px 20px 0;
}
header #branding h1 {
margin: 0;
}
header nav {
float: right;
margin-top: 14px;
}
header .highlight, header .current a {
color: #FFEE00 /*YELLOW*/;
}
header a:hover {
color: #cccccc;
font-weight: bold;
}
/*SHOWCASE*/
#showcase {
background:url("../img/grass.jpg") no-repeat;
background-size: cover;
min-height: 450px;
text-align: center;
color: white;
}
#showcase h1 { /**/
margin-top: 150px;
font-size: 60px;
margin-bottom: 10px;
}
#showcase p {
font-size: 30px;
}
/* CONTACT INFO */
#contact {
color: white;
background: #1CAC4B;
padding: 25px;
border-bottom: #FFEE00 3px solid;
border-top: #FFEE00 3px solid;
}
#contact h1 {
float: left;
}
#contact p {
font-size: 20px;
margin-top: 22px;
font-weight: bold;
float: right;
}
/*BOXES*/
.boxes {
background: white; /*Background behind 3 circular images are white */
display: flex; /*Makes circles drop if page is squished */
flex-wrap: wrap; /*Makes circles in a horizontal row */
justify-content: center;
}
.boxes figure {
margin: 3.5%; /*makes it line up better */
text-align: center; /*Puts text in center*/
font-size: 20px;
}
.boxes figure img {
border-radius: 25px; /*Makes images circular */
width: 310px; /*Sets image width*/
height: 220px; /*Sets image height - heigh and width must be same to make it a circular */
box-shadow: gray 0 0 15px; /*Adds gray shadow to bottom of images */
}
/*MAIN-COL*/
article#main-col {
float: left;
width: 70%;
}
/*ABOUT PAGE SIDEBAR*/
aside#about-sidebar {
float: right;
margin-top: 50px;
}
aside#about-sidebar img {
width: 230px;
height: 184px;
/*257px*/
}
/*SERVICES*/
ul#services li {
list-style: none;
padding: 20px;
border: green solid 1px;
margin-bottom: 10px;
background: #e6e6e6;
}
/*SERVICES PAGE SIDEBAR*/
aside#service-sidebar {
float: right;
margin-top: 50px;
}
/*GALLERY SLIDESHOW*/
* {box-sizing: border-box}
.mySlides1, .mySlides2 {display: none}
img {vertical-align: middle;}
/* Slideshow container */
.slideshow-container {
max-width: 800px;
position: relative;
margin: auto;
padding: 10px;
}
/* Next & previous buttons */
.prev, .next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -22px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
}
/* Position the "next button" to the right */
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
/* On hover, add a grey background color */
.prev:hover, .next:hover {
background-color: #f1f1f1;
color: black;
}
/*FOOTER*/
footer {
padding: 20px;
margin-top: 20px;
color: white;
background-color: #1CAC4B;
text-align: center;
}
/*MEDIA QUERIES*/
#media(max-width: 768px){
header #branding,
header nav,
header nav li,
#boxes .box,
article#main-col,
aside#sidebar {
float: none;
align-content: center;
text-align: center;
width: 100%;
}
header {
padding-bottom: 20px;
}
#showcase h1 {
margin-top: 40px;
}
}
<body>
<main>
<header>
<div class="container">
<div id="branding-img">
<a href="index.html"><img src="https://cdn3.iconfinder.com/data/icons/business-avatar-1/512/10_avatar-512.png">
</div>
<div id="branding">
<h1><span class="highlight">NAME SHORT</span>NAME</h1>
</div>
<nav>
<ul>
<li>Home</li>
<li class="current">About</li>
<li>Services</li>
<li>Gallery</li>
</ul>
</nav>
</div>
</header>
<section id="main">
<div class="container">
<article id="main-col">
<h1 class="page-title">About The Company</h1>
<p class="dark">
Curabitur non accumsan tortor. Nulla aliquet risus ac velit consequat pretium. Duis vulputate congue commodo. Proin id mauris velit. Curabitur vel neque congue turpis dictum tristique. Vestibulum sit amet placerat quam. Sed sodales, lacus fermentum condimentum congue, leo mi congue nibh, sit amet aliquam risus sapien ut tellus.Curabitur non accumsan tortor. Nulla aliquet risus ac velit consequat pretium. Duis vulputate congue commodo. Proin id mauris velit. Curabitur vel neque congue turpis dictum tristique. Vestibulum sit amet placerat quam. Sed sodales, lacus fermentum condimentum congue, leo mi congue nibh, sit amet aliquam risus sapien ut tellus.
</p>
<h1 class="page-title">About Me</h1>
<p class="dark">
Curabitur non accumsan tortor. Nulla aliquet risus ac velit consequat pretium. Duis vulputate congue commodo. Proin id mauris velit. Curabitur vel neque congue turpis dictum tristique. Vestibulum sit amet placerat quam. Sed sodales, lacus fermentum condimentum congue, leo mi congue nibh, sit amet aliquam risus sapien ut tellus.
<br>
<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sit amet sapien quis felis imperdiet scelerisque. Maecenas vulputate, nisl quis laoreet efficitur, urna nunc viverra massa, placerat commodo ligula tellus vel lacus. Ut molestie, purus id gravida sollicitudin, ipsum ipsum scelerisque diam, quis hendrerit mauris massa vitae quam. Donec maximus, felis sit amet tincidunt pretium, justo tellus cursus ex, quis vestibulum felis risus sed velit. Vivamus varius sapien sit amet nisl iaculis, et aliquet risus lobortis. In eget ullamcorper augue. If you are interested you can call me using my email or phone number displayed on the <a id="hyperlink" href="index.html">Home</a> page.
</p>
</article>
<aside id="about-sidebar">
<div class="dark">
<img src="https://cdn3.iconfinder.com/data/icons/business-avatar-1/512/10_avatar-512.png">
<p>
PERSON NAME
</p>
</div>
</aside>
</div>
</section>
<footer>
<p>COMPANY</p>
</footer>
</main>
</body>
Of course, as soon as I spent 10 minutes making this question I figured out my problem within literally 10 seconds lol.
I doubt anyone else would have this problem but you never know, so I'll answer it and leave it here for anyone who needs it.
In the CSS file in the media queries section, I removed '#sidebar' from 'aside#sidebar {'
I'm trying to make an overlapping effect when the user scrolls using the sticky position and giving each div (section) a new background colour. However, even after setting top to 0 for the sticky position, the divs scroll out of the viewport. Any help would be great!
$(document).ready(function(){
$('#about').click(function(){
$('#aboutcontainer').slideToggle('slow');
});
});
html, body {
margin: 0 auto;
font-size: 22px;
width: 100%;
height: 100%;
}
h3 {
margin: 0;
}
ul, li {
margin: 0 auto;
}
span {
font-weight: 400;
}
.container {
height:102vh;
}
.contentcontainer {
display: flex;
justify-content: center;
align-items: center;
height: auto;
}
.vertical-center {
margin: 0;
position: absolute;
top: 50%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
#navbar {
width: 100%;
position: sticky;
top: 0px;
background-color: #ffffff;
font-family: Abel;
height: 100px;
}
#desktop-nav-wrapper {
padding: 0 45px;
height: inherit;
position: relative;
}
#logo {
font-size: 200%;
width: auto;
float: left;
letter-spacing: 3px;
}
#desktop-nav-wrapper ul {
margin-top: 6.5vh;
float: right;
}
#desktop-nav-wrapper li {
position: relative;
display: inline-block;
padding-left: 25px;
font-weight: 300;
color: #000000;
font-family: Abel;
}
#desktop-nav-wrapper li:nth-child(even):hover {
cursor: default;
}
#desktop-nav-wrapper li:nth-child(odd):hover {
cursor: pointer;
}
#aboutcontainer {
display: none;
background-color: #ffffff;
}
#aboutcontainer p {
margin-bottom: 0;
padding-left: 45px;
text-align: left;
width: 80%;
font-family: Lato;
font-weight: 300;
font-size: 92%;
}
#one {
background-color: #ffd700;
position: sticky;
top: 0;
}
#two {
background-color: #468499;
position: sticky;
top: 0;
}
#three {
background-color: #468499;
position: sticky;
top: 0;
}
#media only screen and (max-width: 768px) {
#logo {
margin-top: -1vh;
}
#desktop-nav-wrapper {
padding: 0 15px;
height: inherit;
}
#desktop-nav-wrapper ul {
float: left;
padding-left: 0;
width: 100%;
margin-top: 11vh;
}
#desktop-nav-wrapper li {
position: relative;
display: inline-block;
padding-left: 0;
margin-right: 2%;
font-weight: 300;
color: #000000;
font-family: Abel;
}
#aboutcontainer p {
margin-bottom: 0;
padding-left: 15px;
text-align: left;
width: 90%;
font-family: Lato;
font-weight: 300;
font-size: 80%;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="navbar">
<div id="desktop-nav-wrapper">
<h3 id="logo" class="vertical-center">Test Header</h3>
<ul>
<li id="about" class="desktop-items">about</li>
</ul>
</div>
</div>
<div id="aboutcontainer" style="display: none;">
<p>
Phasellus vitae semper risus. Quisque in finibus nisi. Sed non rhoncus purus, eu luctus orci. Vestibulum massa nisi, bibendum eget libero ut, tempor mattis metus. Maecenas placerat nisl non mauris fringilla ultricies. Phasellus dignissim velit vitae tellus sodales luctus. Nullam tempus turpis vitae nunc lacinia faucibus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eget volutpat nunc. Cras et libero et ligula suscipit finibus et id dui. Duis odio enim, interdum vitae ullamcorper ut, sagittis vitae metus. Phasellus feugiat libero metus, sed tempor erat porttitor ut. Integer vel libero eu ante sollicitudin fermentum non quis nisl. Aliquam blandit dignissim sem, et malesuada risus venenatis eget. Nulla pretium ornare dui fermentum cursus.
</p>
</div>
<div class="container" id="one">
<div class="contentcontainer">
<h3>One</h3>
</div>
</div>
<div class="container" id="two">
<div class="contentcontainer">
<h3>Two</h3>
</div>
</div>
<div class="container" id="three">
<div class="contentcontainer">
<h3>Three</h3>
</div>
</div>
Figured it out... Turns out position: sticky isn't a fan of HTML and body having their height set to 100%. I removed it and it now works fine.
https://codepen.io/SynergyOfLife/pen/rPVYQW.
I have a sticky header with a dropdown menu. It works just fine, but around my dropdown menu, I have a darker background color than the rest of my header on my main li items.
var $fixme = $( '.fixme' );
var fixmeTop = $fixme.offset().top;
var $main = $( 'main' );
var $win = $( window );
$win.scroll( function () {
var atSticky = $win.scrollTop() >= fixmeTop;
$fixme.toggleClass( 'sticky', atSticky );
$main.css( 'padding-top', atSticky ? fixmeTop + 5 : 0 );
} );
$(function () {
$(document).scroll(function () {
var $nav = $(".fixme");
$nav.toggleClass('scrolled', $(this).scrollTop() > $nav.height());
});
});
#import url(css/bootstrap.min.css);
#import url(css/font-awesome.min.css);
/* Min CSS */
.fixed {
position: fixed;
top: 0;
left: 0;
}
.span-width {
width: 100%;
}
.align-right {
float: right;
}
.sticky {
position: fixed;
top: 0;
left: 0;
}
* {
margin: 0;
padding: 0;
}
body {
background-color: #181818;
color: #dddddd;
font-size: 14px;
}
.fixme {
width: 100%;
}
.right {
float: right;
margin: 0 34px;
padding: 0 15px;
}
a,
a:hover,
a:focus {
font-size: 16px;
outline: 0 solid transparent;
text-decoration: none;
transition-duration: 500ms;
}
ul,
ol {
margin: 0;
}
ul li,
ol li {
list-style: none;
}
/* Header Area CSS */
.header-area {
width: 100%;
}
.header-area .top-header-area {
height: 85px;
padding-right: 70px;
width: 100%;
}
.header-area .top-header-area .top-search-area form {
position: relative;
width: 255px;
}
.header-area .top-header-area .top-search-area form input {
background-color: #1a1a1a;
border: none;
border-radius: 10px;
color: #ababab;
font-size: 12px;
font-style: italic;
height: 42px;
padding: 0 20px;
transition-duration: 500ms;
width: 100%;
}
.header-area .top-header-area .top-search-area form button {
background-color: transparent;
color: #555555;
cursor: pointer;
height: 42px;
position: absolute;
right: 0;
top: 0;
width: 50px;
}
.header-area .top-header-area .top-search-area form button:hover {
color: #20d8da;
}
.header-area .top-header-area .login-area a {
border-radius: 10px;
color: #555555;
display: block;
font-size: 14px;
font-weight: 400;
height: 42px;
line-height: 42px;
margin-left: 10px;
text-align: center;
transition: background-color color ease-in-out 400ms;
width: 160px;
}
.header-area .top-header-area .login-area a:hover {
background-color: black;
color: #f06040;
}
.p {
color: green;
padding: 20px 0;
}
/* NavBar CSS */
.header-area .fixme #main-navigation {
background-color: #181818e6;
height: 70px;
padding: 20px 110px 0 110px;
width: auto;
}
.header-area .fixme #main-navigation li {
background-color: #181818e6;
position: relative;
}
.header-area .fixme #main-navigation>li {
float: left;
margin-right: 5px;
}
.header-area .fixme #main-navigation li a {
color: #f06040;
display: block;
font-weight: 500;
line-height: 1em;
padding: .5em;
text-decoration: none;
}
.header-area .fixme #main-navigation li a:hover {
color: #20d8da;
}
.header-area .fixme ul.folder-child {
height: 0;
left: 0;
margin-top: 15px;
opacity: 0;
overflow: hidden;
position: absolute;
top: 100%;
transition: all 200ms ease-in-out;
visibility: hidden;
width: 150px;
}
.header-area .fixme #main-navigation li:hover>ul.folder-child {
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
height: 100px;
opacity: 1;
visibility: visible;
}
.hidden-caret {
visibility: hidden;
}
<header class="header-area">
<div class="top-header-area">
<p style="float: left; font-size: 32px;">Logo Here</p>
<div class="row h-100 align-items-center right">
<div class="d-flex">
<div class="d-flex">
<div class="top-search-area">
<form action="#" method="post">
<input type="search" name="top-search" id="topSearch" placeholder="Search">
<button type="submit" class="btn"><i class="fa fa-search"></i></button>
</form>
</div>
<div class="login-area">
<span>Login / Register</span> <i class="fa fa-lock" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
</div>
<div class="fixme">
<ul id="main-navigation">
<li>Fill <i class="fa fa-caret-down hidden-caret"></i></li>
<li>
In <i class="fa fa-caret-down"></i>
<ul class="folder-child">
<li>a</li>
<li>b</li>
<li>c</li>
</ul>
</li>
<li>This <i class="fa fa-caret-down hidden-caret"></i>
</li>
<li>
Here! <i class="fa fa-caret-down"></i>
<ul class="folder-child">
<li>d</li>
<li>e</li>
<li>f</li>
</ul>
</li>
<li>Contact <i class="fa fa-caret-down hidden-caret"></i></li>
</ul>
</div>
</header>
<main>
<p class="p">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Sollicitudin tempor id eu nisl nunc. Massa enim nec dui nunc mattis enim ut tellus. Diam maecenas ultricies mi eget mauris pharetra et ultrices.
<br>
<p class="p">Nulla aliquet porttitor lacus luctus. Tristique et egestas quis ipsum. Gravida rutrum quisque non tellus orci ac auctor. Nisl suscipit adipiscing bibendum est ultricies. Vulputate odio ut enim blandit. Blandit volutpat maecenas volutpat blandit aliquam. Purus in mollis nunc sed id semper risus.</p>
<br>
<br>
<br>
<br>
<p>Nulla aliquet porttitor lacus luctus. Tristique et egestas quis ipsum. Gravida rutrum quisque non tellus orci ac auctor. Nisl suscipit adipiscing bibendum est ultricies. Vulputate odio ut enim blandit. Blandit volutpat maecenas volutpat blandit aliquam. Purus in mollis nunc sed id semper risus.</p>
<br>
<br>
<br>
<br>
<br>
<p>Nulla aliquet porttitor lacus luctus. Tristique et egestas quis ipsum. Gravida rutrum quisque non tellus orci ac auctor. Nisl suscipit adipiscing bibendum est ultricies. Vulputate odio ut enim blandit. Blandit volutpat maecenas volutpat blandit aliquam. Purus in mollis nunc sed id semper risus.</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
I have deleted all the background-color selectors, one by one, but I still get the weird background color.
I am using rgba, so the overlapping background colors may make it darker. Any suggestions?
Remove this rule:
.header-area .fixme #main-navigation { /* and/or ... li */
background-color: #181818e6;
}
If you want to keep the explicit styling, remove the last two characters. They essentially change the gray and make the first two characters an alph-channel (transparency) modifier.
I've got an audacious project and would like some advice. I want to have a site that uses CSS Diamonds, I've attached an image to give a better idea of what I am looking at doing. Here are the issues I have run into so far:
The triangles are perfectly aligned until a submenu is added, then the right three shift to the right (this was working at one point). Also the li in which the submenu is under loses its diamond
The text on the submenu diamonds are not centered.
I cannot have the background image, then diamond then title. I have tried different z-indexs and it hasn't worked. (To see the menu titles, the background image needs to be removed, and the diamonds need to be -1 z-indexed)
Because I need to use spans to create the triangle text wrapping for the sidebar I cannot just make the sidebar div a diamond, so I still need to add the diamond in below it.
It would be great to have both the right text body and the sidebar text body wrap to the diamond, however I think this is not possible, therefore I reverted to just having the sidebar wrap.
Here is my HTML so far: I have commented out the submenu and my sidebar diamond attempt. http://jsfiddle.net/s4XXE/
/* reset.css */
html {
margin: 0;
padding: 0;
border: 0;
}
body,
div,
span,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
code,
del,
dfn,
em,
img,
q,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
dialog,
figure,
footer,
header,
hgroup,
nav,
section {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
article,
aside,
details,
figcaption,
figure,
dialog,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
body {
line-height: 1.5;
background: white;
}
table {
border-collapse: separate;
border-spacing: 0;
}
caption,
th,
td {
text-align: left;
font-weight: normal;
float: none !important;
}
table,
th,
td {
vertical-align: middle;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
}
blockquote,
q {
quotes: """";
}
a img {
border: none;
}
:focus {
outline: 0;
}
/* typography.css */
html {
font-size: 100.01%;
}
body {
font-size: 75%;
color: #222;
background: #fff;
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: normal;
color: #d10000;
}
h1 {
font-size: 3em;
line-height: 1;
margin-bottom: 0.5em;
}
h2 {
font-size: 2em;
margin-bottom: 0.75em;
}
h3 {
font-size: 1.5em;
line-height: 1;
margin-bottom: 1em;
}
h4 {
font-size: 1.2em;
line-height: 1.25;
margin-bottom: 1.25em;
}
h5 {
font-size: 1em;
font-weight: bold;
margin-bottom: 1.5em;
}
h6 {
font-size: 1em;
font-weight: bold;
}
h1 img,
h2 img,
h3 img,
h4 img,
h5 img,
h6 img {
margin: 0;
}
p {
margin: 0 0 1.5em;
}
.left {
float: left !important;
}
p .left {
margin: 1.5em 1.5em 1.5em 0;
padding: 0;
}
.right {
float: right !important;
}
p .right {
margin: 1.5em 0 1.5em 1.5em;
padding: 0;
}
a:focus,
a:hover {
color: #09f;
}
a {
color: #06c;
text-decoration: underline;
}
blockquote {
margin: 1.5em;
color: #666;
font-style: italic;
}
strong,
dfn {
font-weight: bold;
}
em,
dfn {
font-style: italic;
}
sup,
sub {
line-height: 0;
}
abbr,
acronym {
border-bottom: 1px dotted #666;
}
address {
margin: 0 0 1.5em;
font-style: italic;
}
del {
color: #666;
}
pre {
margin: 1.5em 0;
white-space: pre;
}
pre,
code,
tt {
font: 1em'andale mono', 'lucida console', monospace;
line-height: 1.5;
}
li ul,
li ol {
margin: 0;
}
ul,
ol {
margin: 0 1.5em 1.5em 0;
padding-left: 1.5em;
}
ul {
list-style-type: disc;
}
ol {
list-style-type: decimal;
}
dl {
margin: 0 0 1.5em 0;
}
dl dt {
font-weight: bold;
}
dd {
margin-left: 1.5em;
}
table {
margin-bottom: 1.4em;
width: 100%;
}
th {
font-weight: bold;
}
thead th {
background: #c3d9ff;
}
th,
td,
caption {
padding: 4px 10px 4px 5px;
}
tbody tr:nth-child(even) td,
tbody tr.even td {
background: #e5ecf9;
}
tfoot {
font-style: italic;
}
caption {
background: #eee;
}
.small {
font-size: .8em;
margin-bottom: 1.875em;
line-height: 1.875em;
}
.large {
font-size: 1.2em;
line-height: 2.5em;
margin-bottom: 1.25em;
}
.hide {
display: none;
}
.quiet {
color: #666;
}
.loud {
color: #000;
}
.highlight {
background: #ff0;
}
.added {
background: #060;
color: #fff;
}
.removed {
background: #900;
color: #fff;
}
.first {
margin-left: 0;
padding-left: 0;
}
.last {
margin-right: 0;
padding-right: 0;
}
.top {
margin-top: 0;
padding-top: 0;
}
.bottom {
margin-bottom: 0;
padding-bottom: 0;
}
/* Customization */
body {
background: #efefef;
margin: 0px auto;
width: 1320px;
}
#bodydiv {
width: 100%;
background-image: url('http://i.stack.imgur.com/QVfwy.png');
background-repeat: repeat;
overflow: hidden;
}
ul {
list-style: none;
position: relative;
width: 100%;
text-align: center;
padding: 0px 0px 0px 28.6em;
margin-bottom: 0px;
display: block;
}
li {
float: left;
margin: 0em -1.45em;
font-weight: bold;
font-size: 2em;
}
ul li a {
color: red;
text-decoration: none;
}
ul li a:hover {
color: #eee;
text-decoration: none;
}
.triangle:after {
content: '';
position: relative;
top: 105px;
margin-left: -50%;
border: 5em solid transparent;
border-top-color: red;
z-index: 1;
}
li:nth-child(1).triangle:after {
border-top-color: blue;
}
li:nth-child(2).triangle:after {
border-top-color: green;
}
li:nth-child(3).triangle:after {
border-top-color: purple;
}
ul li ul {
font-size: .5em;
}
ul li ul a {
z-index: 1;
}
.diamond,
.diamond:after {
width: 0;
height: 0;
border: 4em solid transparent;
content: '';
z-index: 1;
}
.diamond {
border-bottom-color: red;
position: absolute;
top: -1em;
}
.diamond:after {
position: absolute;
margin-left: -4em;
top: 4em;
border-top-color: red;
}
.diamond.big,
.diamond.big:after {
width: 0;
height: 0;
border: 9em solid transparent;
content: '';
z-index: 1;
}
.diamond.big {
border-bottom-color: red;
position: absolute;
}
.diamond.big:after {
margin-left: -9em;
top: 9em;
border-top-color: red;
}
.diamond.huge,
.diamond.huge:after {
width: 0;
height: 0;
border: 500px solid transparent;
content: '';
z-index: 1;
}
.diamond.huge {
top: -500px;
border-bottom-color: red;
position: absolute;
}
.diamond.huge:after {
margin-left: -500px;
top: 500px;
border-top-color: red;
}
li:hover > ul li {
display: none;
}
ul ul li {
font-size: 1em;
display: block;
position: relative;
left: 1em;
margin-left: 1em;
margin-top: 1em;
}
ul ul li:nth-child(1).diamond {
border-bottom-color: orange;
top: 4em;
left: 6em;
}
ul ul li:nth-child(1).diamond:after {
border-top-color: orange;
}
ul ul li:nth-child(2).diamond {
border-bottom-color: aqua;
}
ul ul li:nth-child(2).diamond:after {
border-top-color: aqua;
}
*/
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Triangles</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=479;">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="bodydiv">
<ul>
<li class="current index triangle submenu">Home
<!--
<ul><li class="diamond">subpage 1</li><li class="diamond">subpage 2</li></ul>
-->
</li>
<li class="about triangle">Home
</li>
<li class="contact triangle">Home
</li>
<li class="other triangle">Home
</li>
</ul>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<h1>
Heading for the page
</h1>
<div style="width:60%; float:left;">
<p style="font-size:1em; color:black;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at tellus ipsum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nunc et erat magna. Aenean volutpat ultrices quam nec vestibulum. Nullam
quis ante vel tellus mattis laoreet. Duis vehicula est id lorem consequat pretium. Suspendisse potenti.
</p>
<p style="font-size:1em; color:black;">
Donec ut nunc ante, vel elementum ante. Vivamus mattis ornare fermentum. Quisque vitae justo quam. Cras nunc odio, sodales a condimentum id, laoreet sed neque. Integer adipiscing placerat sollicitudin. Etiam posuere, lacus ut bibendum mattis, nibh urna
ullamcorper nibh, vitae blandit massa nunc ac augue. Aliquam mollis aliquam magna eget rutrum. Suspendisse iaculis placerat dolor, at venenatis eros rutrum non. Phasellus pretium risus ac nisi sollicitudin sit amet adipiscing nisl malesuada. Cras
nisi nunc, hendrerit at elementum in, auctor a ligula. Maecenas pharetra condimentum aliquam. Nulla et ultricies nisi. Donec vitae neque ac augue iaculis pretium nec sed ipsum. Sed gravida facilisis congue. Nullam lobortis interdum augue ac venenatis.
Sed luctus turpis sed urna sollicitudin imperdiet.
</p>
<p style="font-size:1em; color:black;">
Nam lectus lacus, ultricies non placerat in, consectetur lacinia urna. Duis orci eros, porta nec tempus vitae, sollicitudin ac massa. Nam porta dignissim bibendum. Aenean hendrerit lacinia nisi vel viverra. Maecenas eu mi orci, vel laoreet massa. Fusce
rhoncus, tellus eu consectetur eleifend, lacus enim ultricies diam, ut rutrum mauris dolor nec nibh. Suspendisse tincidunt neque vitae ligula adipiscing consectetur quis et nisl. Fusce eu sem diam. Aenean iaculis laoreet lacus, a vulputate augue
egestas ut. Donec fringilla nisi sit amet arcu convallis in egestas nisl imperdiet. Nam interdum dolor nec nibh auctor eget sollicitudin orci iaculis. Proin turpis sem, ultricies facilisis euismod in, mattis in justo. Morbi feugiat semper blandit.
Quisque tincidunt semper sodales. Nullam suscipit tempor gravida.
</p>
<p style="font-size:1em; color:black;">
Vivamus eu diam id libero rhoncus ultrices ut eu lectus. Praesent diam elit, luctus a lobortis ac, faucibus in nisl. Duis id est purus, a condimentum leo. Quisque gravida metus sed arcu placerat nec convallis quam blandit. Cras laoreet vulputate sem et
consectetur. Curabitur felis erat, auctor vitae eleifend id, suscipit eget sapien. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam porttitor ultricies tortor in tincidunt.
</p>
<p style="font-size:1em; color:black;">
In hac habitasse platea dictumst. Sed erat leo, cursus vel pellentesque quis, pretium quis mi. Integer interdum neque non nisi luctus sollicitudin pellentesque nunc consectetur. Fusce auctor bibendum porta. Donec in est lacus, in luctus purus. Proin consectetur
molestie urna, eu laoreet ligula pellentesque eget. Cras at magna sit amet lacus consectetur viverra. Mauris sed faucibus nisl.
</p>
<style>
.lW {
float: left;
clear: left;
height: 18px;
}
.rW {
float: right;
clear: right;
height: 18px;
}
</style>
</div>
<div style="font-size:1em; color:black; width:40%; float:right;" class="sidebardiamond">
<div class="diamond big" style="position:relative; left:301px; top:-150px;">What is ACM?</div>
<div class="lW" style="width:78%;"></div>
<div class="lW" style="width:74.6%;"></div>
<div class="lW" style="width:71.2%;"></div>
<div class="lW" style="width:67.8%;"></div>
<div class="lW" style="width:64.4%;"></div>
<div class="lW" style="width:61%;"></div>
<div class="lW" style="width:57.6%;"></div>
<div class="lW" style="width:54.2%;"></div>
<div class="lW" style="width:50.8%;"></div>
<div class="lW" style="width:47.4%;"></div>
<div class="lW" style="width:44%;"></div>
<div class="lW" style="width:40.6%;"></div>
<div class="lW" style="width:44.4%;"></div>
<div class="lW" style="width:47.8%;"></div>
<div class="lW" style="width:51.2%;"></div>
<div class="lW" style="width:54.6%;"></div>
<div class="lW" style="width:58%;"></div>
<div class="lW" style="width:61.4%;"></div>
<div class="lW" style="width:64.8%;"></div>
<div class="lW" style="width:68.2%;"></div>
<div class="lW" style="width:71.6%;"></div>
<div class="lW" style="width:75%;"></div>
<div class="lW" style="width:78.4%;"></div>
<div class="lW" style="width:81.8%;"></div>
In hac habitasse platea dictumst. Sed erat leo, cursus vel pellentesque quis, pretium quis mi. Integer interdum neque non nisi luctus sollicitudin pellentesque nunc consectetur. Fusce auctor bibendum porta. Donec in est lacus, in luctus purus. Proin consectetur
molestie urna, eu laoreet ligula pellentesque eget. Cras at magna sit amet lacus consectetur viverra. Mauris sed faucibus nisl.</div>
<!--<div class="diamond huge" style="position:relative; left:5px; top:150px;"></div>
<br>-->
</div>
</body>
</html>
Good news! I have solved most of my issues. Here is my updated jsfiddle: http://jsfiddle.net/s4XXE/1/ I will continue to work on fixing all issues. Any assistance would be helpful.
FIXED: I used the submenu class to correct the offset that was caused by the addition of a submenu.
FIXED: The titles do show up now. I think I added display:relative; to the CSS so that it accepted the z-index
FIXED: Changed the triangles on the menu to before instead of after so the triangles still show up on the menus with submenus.
BUG: The submenus are shown when the mouse gets close to the menu item. It should just be showing the submenus when the mouse is on the triangle.
BUG: On the menu items a link is only 'valid' when the mouse is over the text. It would be nice to have it 'valid' when it is over the shape.
BUG: The titles on the submenus and sidebar title are still not centered.
BUG: Changing the "Home" titles messes everything up. (need to adjust for changing content)