Bootstrap timeline responsive layout issues - html

I have been using a sample timeline built using Bootstrap, and so far it works reasonably well, but upon resizing some of the layout doesn't quite line up. I've customized the code so that all of the timeline items are on the right of the line itself, and now I'm having issues lining up the icons for each item and also the final icon at the end.
I apologize for the messy fiddle, but here is my fiddle:
http://jsfiddle.net/36yt7srz/
You can see that on the final circle at the bottom, when the window is small it lines up roughly in the middle of the timeline, but when the window is resized it is out of sync with that line. I could use some media queries but I felt that this would inevitably end up with a circle which still will be out of line at some window sizes.
I'm looking for a way to essentially get the circle to just follow the line.
Here is the HTML:
<!-- content -->
<div class="col-md-12 content page">
<!-- header icon -->
<div class="col-xs-3">
<img class="img-responsive" src="http://s21.postimg.org/s3hybqfwz/icon.jpg">
</div>
<!-- header text -->
<div class="col-xs-9 schedule-header-text">
<img class="img-responsive" src="http://s27.postimg.org/4y34y273z/text.jpg">
</div>
<!-- Timeline -->
<div class="col-xs-12">
<ul class="timeline">
<li class="timeline-inverted">
<div class="tl-circ"></div>
<div class="timeline-panel">
<div class="tl-heading">
<h4>Date</h4>
</div>
<div class="tl-body">
<p>Content</p>
<p><small class="text-muted"><i class="fa fa-map-marker"></i> Location</small></p>
</div>
</div>
</li>
<li class="timeline-inverted">
<div class="tl-circ"></div>
<div class="timeline-panel">
<div class="tl-heading">
<h4>Date</h4>
</div>
<div class="tl-body">
<p>Content</p>
<p><small class="text-muted"><i class="fa fa-map-marker"></i> Location</small></p>
</div>
</div>
</li>
<li class="timeline-inverted">
<div class="tl-circ-empty"></div>
</li>
</ul>
</div>
Here is the CSS:
/** timeline box structure **/
.timeline {
list-style: none;
padding: 20px 0 20px;
position: relative;
}
.timeline:before {
top: 0;
bottom: 0;
position: absolute;
content: " ";
width: 2px;
background-color: #504f4f;
left: 5%;
}
.timeline li {
margin-bottom: 25px;
position: relative;
}
.timeline li:before, .timeline li:after {
content: " ";
display: table;
}
.timeline li:after {
clear: both;
}
.timeline li:before, .timeline li:after {
content: " ";
display: table;
}
/** timeline panels **/
.timeline li .timeline-panel {
width: 90%;
float: left;
background: rgba(0,0,0,0.6);
padding: 10px;
position: relative;
top: 23px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.timeline li .timeline-panel.noarrow:before, .timeline li .timeline-panel.noarrow:after {
top:0;
right:0;
display: none;
border: 0;
}
.timeline li.timeline-inverted .timeline-panel {
float: right;
}
.timeline li.timeline-inverted .timeline-panel:before {
border-left-width: 0;
border-right-width: 15px;
left: -15px;
right: auto;
}
.timeline li.timeline-inverted .timeline-panel:after {
border-left-width: 0;
border-right-width: 14px;
left: -14px;
right: auto;
}
/** timeline circle icons **/
.timeline li .tl-circ {
position: absolute;
top: 23px;
left: 5%;
text-align: center;
background: url(../img/schedule-icon.png);
color: #fff;
width: 35px;
height: 35px;
margin-left: -13px;
z-index: 99999;
}
.timeline li .tl-circ-empty {
position: absolute;
top: 35px;
left: 46px;
text-align: center;
background: #434343;
width: 15px;
height: 15px;
margin-left: -13px;
border: 3px solid #434343;
border-top-right-radius: 50%;
border-top-left-radius: 50%;
border-bottom-right-radius: 50%;
border-bottom-left-radius: 50%;
z-index: 99999;
}
/** timeline content **/
.tl-heading h4 {
margin: 0 0 10px 0;
color: #fafafa;
}
.tl-body p, .tl-body ul {
margin-bottom: 0;
color: #fafafa;
}
.tl-body > p + p {
margin-top: 5px;
}
/** media queries **/
#media (max-width: 991px) {
.timeline li .timeline-panel {
width: 90%;
}
}
#media (max-width: 700px) {
.page-header h1 { font-size: 1.8em; }
ul.timeline:before {
left: 40px;
}
ul.timeline li .timeline-panel {
width: calc(100% - 90px);
width: -moz-calc(100% - 90px);
width: -webkit-calc(100% - 90px);
}
ul.timeline li .tl-circ {
top: 22px;
left: 22px;
margin-left: 0;
}
ul.timeline > li > .timeline-panel {
float: right;
}
ul.timeline > li > .timeline-panel:before {
border-left-width: 0;
border-right-width: 15px;
left: -15px;
right: auto;
}
ul.timeline > li > .timeline-panel:after {
border-left-width: 0;
border-right-width: 14px;
left: -14px;
right: auto;
}
}
.schedule-header-text {
padding-top: 12px;
}
.schedule-header-text img {
max-width: 75%;
}
.content.page {
padding: 5%;
}

I don't know if I understood you correctly.
But here is what I did to make it align (I changed the color for visibility)
.timeline li .tl-circ-empty {
position: absolute;
top: 35px;
left: 5%;
text-align: center;
background: red;
width: 15px;
height: 15px;
margin-left: -7.5px;
border: 3px solid red;
border-radius: 50%;
z-index: 99999;
}
And I added the following
#media (max-width: 700px){
ul.timeline li .tl-circ-empty {
left: 22px;
margin-left: 10px;
}
}
I am in a rush to go somewhere. Tell me if this didn't solve your question.
EDIT1
PS.Like I mentioned above, I didn't have enough time to read through your css completely. I focused on the .tl-circ-emptyclass to create a fix without touching the whole css structure to minify the damage.
EDIT2
I remember dealing with making Vertical Timelines myself.
I learned a lot following this.

Related

Position absolute inside a scrolling overflow container

I have the following code:
.chat-content {
height: 455px;
min-height: 100%;
width: 100%;
overflow-y: auto;
background: #cacac8;
}
.chat-content,
.chat-content-inner {
position: relative;
}
.chat-container {
position: relative;
overflow: hidden;
}
.top-buttons {
position: relative;
display: block;
padding: 10px;
padding-left: 80px;
height: 50px;
background: #dddddb;
top: 0;
right: 0;
left: 0
}
.top-buttons .badge {
position: relative;
border-radius: 3px;
padding: 7px;
margin-left: 10px;
margin-top: 5px;
}
.top-buttons .badge:after {
content: "";
position: absolute;
top: 5px;
left: -5px;
border-style: solid;
border-width: 5px 5px 5px 0px;
border-color: transparent #999;
display: block;
width: 0;
z-index: 1;
}
.top-buttons h2 {
font-weight: 300;
color: #858689
}
.chat-pusher {
position: relative;
}
/*Styling Chat Sidebar Menu*/
.chat-users-menu {
position: absolute;
top: 0;
left: -110px;
z-index: 100;
visibility: visible;
width: 180px;
height: 100%;
background: #858689;
-webkit-transition: all .5s;
transition: all .5s;
overflow-y: auto;
}
/*Toggle Class for Moving Chat Menu Users*/
.chatbar-toggle {
left: 0;
}
/*/Toggle Class for Moving Chat Menu Users*/
.chat-users-menu ul {
margin: 0;
padding: 0;
list-style: none;
}
.chat-users-menu .menu-header {
padding: 10px;
text-align: right;
color: #fff;
font-size: 1.5em;
}
.chat-users-menu ul li a {
position: relative;
display: block;
height: 70px;
padding: 15px 90px 10px 10px;
outline: none;
box-shadow: inset 0 -1px rgba(0, 0, 0, .2);
color: #fff;
text-shadow: 0 0 1px rgba(255, 255, 255, .1);
font-weight: 700;
-webkit-transition: background .3s, box-shadow .3s;
transition: background .3s, box-shadow .3s;
}
.chat-users-menu ul li a .chat-name {
display: block;
text-overflow: ellipsis;
width: 100px;
font-size: 1.05em;
}
.chat-users-menu ul li a .badge {
position: absolute;
background: #d24d33;
color: #fff;
top: 10px;
right: 10px;
}
.chat-users-menu ul li a:hover {
background: rgba(0, 0, 0, .2);
color: #fff;
text-decoration: none;
}
.chat-users-menu ul li a .label {
margin-top: 2px;
}
.chat-users-menu ul li .user-img {
position: absolute;
right: 15px;
top: 15px;
display: block;
max-width: 40px;
}
.chat-users-menu ul li .user-img img {
display: inline-block;
max-width: 100%;
border-radius: 50%;
box-shadow: 0 0 0 5px #fff;
}
/* And finally! Messages List and Chat Contents */
.chat-messages {
padding: 15px;
margin-bottom: 5px;
}
.chat-messages-with-sidebar {
margin-left: 70px;
}
.chat-messages ul {
list-style: none;
margin: 0;
padding: 0;
}
.chat-messages li {
margin-bottom: 10px;
}
.chat-messages li.left .chat-body {
position: relative;
margin-left: 70px;
padding: 10px;
background: #fff;
border-radius: 3px;
}
.chat-messages li.left .chat-body :before {
/*content: "";
position: absolute;
top: 20%;
left: -7px;
border-style: solid;*/
border-width: 6px 7px 6px 0;
border-color: transparent #fff;
/*display: block;
width: 0;*/
}
.chat-messages li.right .chat-body {
position: relative;
margin-right: 70px;
padding: 10px 15px;
background: #fff;
border-radius: 3px;
}
.chat-messages li.right .chat-body :after {
content: "";
position: absolute;
top: 20%;
right: -7px;
border-style: solid;
border-width: 6px 0 6px 7px;
border-color: transparent #fff;
display: block;
width: 0;
}
.chat-messages .badge {
font-size: .85em;
float: right;
border-radius: 3px;
background: #c0c2c7;
}
.chat-messages .chat-body .name {
font-size: 1em;
font-weight: 700;
}
.chat-messages .user-img {
margin-top: 8px;
display: block;
max-width: 45px;
}
.chat-messages .user-img img {
display: inline-block;
max-width: 100%;
border-radius: 50%;
box-shadow: 0 0 0 6px #fff;
}
.chat-message-form {
padding: 15px;
background: #dddddb;
display: block
}
.nano {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}
.nano>.nano-content {
position: absolute;
overflow: scroll;
overflow-x: hidden;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.nano>.nano-content:focus {
outline: thin dotted;
}
.nano>.nano-content::-webkit-scrollbar {
visibility: hidden;
}
.has-scrollbar>.nano-content::-webkit-scrollbar {
visibility: visible;
}
.nano>.nano-pane {
background: rgba(0, 0, 0, .25);
position: absolute;
width: 10px;
right: 0;
top: 0;
bottom: 0;
visibility: hidden\9;
/* Target only IE7 and IE8 with this hack */
opacity: .01;
-webkit-transition: .2s;
-moz-transition: .2s;
-o-transition: .2s;
transition: .2s;
}
.nano>.nano-pane>.nano-slider {
background: #fff;
position: relative;
margin: 0;
}
.nano:hover>.nano-pane,
.nano-pane.active,
.nano-pane.flashed {
visibility: visible\9;
/* Target only IE7 and IE8 with this hack */
opacity: 0.99;
}
.msg-is-typing-container {
position: absolute;
bottom: 0;
}
<div class="chat-container">
<div class="chat-pusher">
<div class="chat-content">
<!-- this is the wrapper for the content -->
<div class="nano">
<!-- this is the nanoscroller -->
<div class="nano-content">
<div class="">
<!-- extra div for emulating position:fixed of the menu -->
<!-- Top Navigation -->
<div class="">
<div class="chat-messages chat-messages-with-sidebar">
<ul id="thread-msg-content" data-msg-thread-id="">
<li class="left clearfix">
<div class="user-img pull-left">
<img src="http://www.simpsonspark.com/images/persos/contributions/bart-simpson-20516.gif" alt="User Avatar" width="50" height="50" />
</div>
<div class="chat-body clearfix">
<div class="header"> <span class="name">Administrator</span><span class="name"></span> <span class="badge"><i class="fa fa-clock-o"></i>2018-06-21 04:38:44</span> …
<div class="chat-body clearfix">
<p>fdfdffdfddfd</p>
</div>
</li>
<li class="left clearfix">
<div class="user-img pull-left">
<img src="http://www.simpsonspark.com/images/persos/contributions/bart-simpson-20516.gif" alt="User Avatar" width="50" height="50" />
</div>
<div class="chat-body clearfix">
<div class="header"> <span class="name">Administrator</span><span class="name"></span> <span class="badge"><i class="fa fa-clock-o"></i>2018-06-21 04:38:44</span> …
<div class="chat-body clearfix">
<p>fdfdffdfddfd</p>
</div>
</li>
<li class="left clearfix">
<div class="user-img pull-left">
<img src="http://www.simpsonspark.com/images/persos/contributions/bart-simpson-20516.gif" alt="User Avatar" width="50" height="50" />
</div>
<div class="chat-body clearfix">
<div class="header"> <span class="name">Administrator</span><span class="name"></span> <span class="badge"><i class="fa fa-clock-o"></i>2018-06-21 04:38:44</span> …
<div class="chat-body clearfix">
<p>fdfdffdfddfd</p>
</div>
</li>
</ul>
<div class="msg-is-typing-container">
<p class="msg-is-typing">Administrator is typing ...</p>
</div>
</div>
</div>
</div>
<!-- /chat-content-inner -->
</div>
</div>
<!-- /nano -->
</div>
<!-- /chat-content -->
</div>
<!-- /chat-pusher -->
</div>
Result I want: https://www.awesomescreenshot.com/image/3438835/f249eeacac535cd7715d72d9c3b1dcb4
I want to show div ".msg-is-typing-container" to the bottom of the container ".chat-content", but when the scroll bar is shown the div ".msg-is-typing-container" is not displayed at the bottom of the container.
How to fix this issue?
Thank you!
I altered .msg-is-typing-container's CSS to achieve the positioning I believe you want.
.msg-is-typing-container{
position: relative;
border: 1px solid red;
display: inline-block;
padding: 5px 10px;
}
I then added a matching id as shown to this element: <p class="msg-is-typing" id="msg-is-typing"></p>
The below jQuery & JavaScript hides the typing container .msg-is-typing-container until the .nano-content container is scrolled to the bottom, at which time the container fades into view. I also added a JavaScript typing effect found here at w3Schools. You can see this JSFiddle where I tried to answer the question as I understood it.
$('.msg-is-typing-container').hide();
$(document).ready(function() {
var i = 0;
var txt = 'Administrator is typing ...And Only Shows when div is scolled to bottom';
var speed = 100;
function typeWriter() {
if (i < txt.length ) {
document.getElementById("msg-is-typing").innerHTML += txt.charAt(i);
i++;
setTimeout(typeWriter, speed);
}
}
$(".nano-content").scroll(function(){
if ($(this).scrollTop()>0) {
$('.msg-is-typing-container').fadeIn(2000);
}
else{
$('.msg-is-typing-container').fadeOut(1000);
}
})
typeWriter();
})
.chat-messages {
position: relative;
margin: 50px;
}
.msg-is-typing-container{
position:absolute;
bottom:-25px;
}

How to hover the complete row in css?

I have a screenshot as shown below which I have replicated in HTML, CSS and JS.
I have created the fiddle for the above screenshot. The above screen-shot portion is at the extreme right in the fiddle. On clicking three dots, the drop-down menu appears.
The HTML and CSS codes which I have used in order to create the drop-down is:
HTML:
<div class="nav-top-searchbar">
<form>
<span class="fa fa-search searchicon fa-lg" aria-hidden="true"></span>
<input type="text" name="search">
<div style="">
<img tabindex="1" src="https://s9.postimg.org/d6s4xvykv/Ellipsis.png" id="ellipsis">
<div class="dropdown">
<li>View Status<i class="fa fa-angle-down" aria-hidden="true"></i></li>
<li>Release Bills</li>
<li>Add Attendee</li>
<li>Export as</li>
<li>View in Google Sheets</li>
<li>Send Notifications</li>
</div>
</div>
</form>
</div>
CSS:
// General CSS
.nav-top-searchbar {
position: relative;
}
#ellipsis {
top: 12px;
position: absolute;
right: 43px;
cursor: pointer;
}
#ellipsis:focus {
outline: none;
}
#ellipsis:focus+.dropdown {
display: block;
}
input[type=text] {
width: 100%;
background: #10314c;
}
.dropdown {
background-color: #FFFFFF;
display: none;
padding-left: 2%;
position: absolute;
/* height: 150px; */
right: 0;
width: 200px;
z-index: 10;
list-style-type: none;
padding-top: 25px;
padding-bottom: 25px;
box-shadow: 0 0 15px #888;
top: 2px;
}
.searchicon {
float: left;
margin-top: -20px;
position: relative;
top: 26px;
left: 8px;
color: white;
border: 1px solid #FFFFFF;
z-index: 2;
padding: 3px;
}
.dropdown a {
color: #676767;
font-weight: bold;
font-size: 14px;
}
.dropdown li:hover {
background-color: #EDEDED;
}
Problem Statement:
In my fiddle, the hover doesn't cover the entire row. It only covers 80% of the row. I am wondering what changes do I need to make in the above CSS codes so that the hover covers the entire row.
You have padding on your dropdown container:
.dropdown{
padding-left: 2%;
}
This space is unusable by the child list items. Put the padding on the list items instead:
.dropdown li{
padding-left: 2%;
}
https://jsfiddle.net/nc2djn5p/94/
This should do the trick: https://jsfiddle.net/hp0hxoL3/
.dropdown {
background-color: #FFFFFF;
display: none;
padding-left: 2%;
position: absolute;
/* height: 150px; */
right: 0;
width: 200px;
z-index: 10;
list-style-type: none;
padding-top:25px;
padding-bottom:25px;
box-shadow: 0 0 15px #888;
top: 2px;
list-style: none;
padding: 0;
margin: 0;
}
.searchicon {
float: left;
margin-top: -20px;
position: relative;
top: 26px;
left: 8px;
color: white;
border: 1px #FFFFFF;
z-index: 2;
}
.dropdown a
{
color: #676767;
font-weight: bold;
font-size: 14px;
}
.dropdown li {
padding: 8px;
}
.dropdown li:hover
{
background-color: #EDEDED;
}
It doesn't match exactly the example, but it's close enough.
Your div class="dropdown" has a left padding of 2%. You will need to set it to 0.
As David said, set the padding in .dropdown li, instead of .dropdown

Angular2: <li> with *ngFor not inside <ul>

I'm going to create a timeline component and I have the following template
<ul *ngIf="alerts!=undefined" class="timeline">
<li *ngFor="let alert of alerts; let i=index" [class.timeline-inverted]="i % 2 == 1">
<div class="timeline-badge">
<span>{{alert.type}}</span>
</div>
<div class="timeline-panel">
<div class="timeline-body">
<p>{{alert.id}}</p>
</div>
<div class="timeline-footer">
<p class="">{{alert.date}}</p>
</div>
</div>
</li>
</ul>
The corresponding .scss file is like
.timeline {
list-style: none;
padding: 10px 0;
position: relative;
font-weight: 300;
border-style: solid;
border-width: medium;
}
.timeline:before {
top: 0;
bottom: 0;
position: absolute;
content:" ";
width: 6px;
background: $magenta;
left: 50%;
margin-left: -3px;
}
.timeline > li {
margin-bottom: 40px;
position: relative;
width: 50%;
float: left;
clear: left;
}
.timeline > li:before, .timeline > li:after {
content:" ";
display: table;
}
.timeline > li:after {
clear: both;
}
.timeline > li > .timeline-panel {
width: calc(100% - 35px);
width: -moz-calc(100% - 35px);
width: -webkit-calc(100% - 35px);
float: left;
border-radius: 5px;
background: $white;
position: relative;
}
.timeline > li > .timeline-panel:before {
position: absolute;
top: 26px;
right: -15px;
display: inline-block;
border-top: 15px solid transparent;
border-bottom: 15px solid transparent;
content:" ";
}
.timeline > li > .timeline-panel:after {
position: absolute;
top: 27px;
right: -14px;
display: inline-block;
border-top: 14px solid transparent;
border-left: 14px solid $white;
border-right: 0 solid $white;
border-bottom: 14px solid transparent;
content:" ";
}
The <ul> tag is not filled by those <li> tag created by *ngFor which makes the "line" of the timeline disappear.
The black border is the border of the <ul> tag, which is suppose to wrap all <li> tags below it and have the magenta line go through all bubbles.
You problem is in CSS
when you use float on li, it actually remove it from the document flow.
By using Overflow:hidden, it will somehow fix this issue.
you can read this answer
Your problem is not with CSS, is it with angular structural directives.
Please read this article,
https://angular.io/guide/structural-directives#group-sibling-elements-with-ng-container
I believe, you will find solution there.

Navigation bar and text moves when viewed on different computers or resized

I am new to this. On my website, when the window is resized or is viewed on a different computer screen, the navigation bar (which is made up of rectangles and triangles) and text moves around and parts disappear. Do the sizes need to be in percentages? If so I am unsure of which parts I need to change.
To view it, please follow this link to my website on Codecademy and click on the full screen button.
body {
background-image: url('http://www.rgbstock.com/cache1u7YbL/users/x/xy/xymonau/300/nXWyMYC.jpg')
}
#background {
background-color: white;
height: 100%;
width: 75%;
position: relative;
top: 100px;
margin-left: auto;
margin-right: auto;
}
#header {
word-wrap: break-word;
border: 1px solid black;
height: 30%;
width: 60%;
position: relative;
bottom: 90px;
margin-left: auto;
margin-right: auto;
}
.photocontainer {
border: transparent;
height: 55%;
width: 65%;
position: relative;
bottom: 60px;
margin-left: auto;
margin-right: auto;
}
.photocontainer img {
width:100%;
height:100%;
}
.navcontainer {
border: 1px solid black;
height: 10%;
width: 99%;
position: relative;
bottom: 70px;
margin-left: auto;
margin-right: auto;
overflow: hidden;
}
.navcontainer .navbar .navigation li {
list-style: none;
display: block;
float: left;
margin: 1em;
text-align: center;
position: relative;
left: 15%;
}
.navcontainer .navbar .navigation li a {
font-family: quicksand;
text-decoration: none;
text-transform: uppercase;
display: block;
width: 110%;
color: #000000;
font-size: 20px;
vertical-align: middle;
line-height: 31px;
}
.navigation li a:hover {
margin-top: 2px;
}
.navbar {
margin: 0 auto;
width: 90%;
position: relative;
bottom: 42px;
}
.navcontainer .navbar .rectangle {
background: #f1e5cd;
height: 62px;
position: relative;
-moz-box-shadow: 0px 0px 4px rgba(0,0,0,0.55);
box-shadow: 0px 0px 4px rgba(0,0,0,0.55);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
z-index: 500; /* the stack order: foreground */
margin: 3em 0;
}
.navcontainer .navbar .l-triangle-top {
border-color: #e7dbc3 transparent transparent;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: left;
top: 1px;
left: -50px;
}
.navcontainer .navbar .l-triangle-bottom {
border-color: transparent transparent #e7dbc3;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: left;
top: -40px;
left: -150px;
}
.navcontainer .navbar .r-triangle-top {
border-color: #e7dbc3 transparent transparent;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: right;
right: -45px;
top: -107px;
}
.navcontainer .navbar .r-triangle-bottom {
border-color: transparent transparent #e7dbc3;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: relative;
float: right;
top: -149px;
right: -145px;
}
<div id="background">
<div id="header"></div>
<div class="navcontainer">
<div class="navbar">
<!-- the left side of the fork effect -->
<div class="l-triangle-top"></div>
<div class="l-triangle-bottom"></div>
<!-- the ribbon body -->
<div class="rectangle">
<!-- the navigation links -->
<ul class="navigation">
<li>Home</li>
<li>About</li>
<li>Menu</li>
<li>Order</li>
<li>Contact</li>
</ul>
<!-- end the ribbon body -->
</div>
<!-- the right side of the fork effect -->
<div class="r-triangle-top"></div>
<div class="r-triangle-bottom"></div>
<!-- end container -->
</div>
</div>
<div class="photocontainer"></div>
Read this article "http://www.w3schools.com/css/css_navbar.asp"
Your code is a bit confused.
Hope this helps.
Here you have a basic example:
ul {
list-style-type: none;
margin: 0;
overflow: hidden;
padding: 0;
}
li {
float: left;
}
a {
background-color: #dddddd;
display: block;
width: 60px;
}
You can find the solution in my fiddle, including absolutely positioned triangles. For simplification purposes I removed your header.
http://jsfiddle.net/L74gdm7j/2/
body {
background-image: url('http://www.rgbstock.com/cache1u7YbL/users/x/xy/xymonau/300/nXWyMYC.jpg')
}
#background {
background-color: white;
height: 100%;
width: 75%;
position: relative;
top: 100px;
margin-left: auto;
margin-right: auto;
}
.photocontainer {
border: transparent;
height: 55%;
width: 65%;
position: relative;
bottom: 60px;
margin-left: auto;
margin-right: auto;
}
.photocontainer img {
width:100%;
height:100%;
}
.navcontainer {
height: 10%;
width: 99%;
margin-left: auto;
margin-right: auto;
overflow: hidden;
}
.navcontainer .navbar .navigation {
text-align: center;
margin: 0;
padding: 0;
}
.navcontainer .navbar .navigation li {
list-style: none;
display: inline-block;
margin: 1em;
text-align: center;
}
.navcontainer .navbar .navigation li a {
font-family: quicksand;
text-decoration: none;
text-transform: uppercase;
color: #000;
font-size: 20px;
line-height: 31px;
transition-duration: 0.2s;
display: inline-block;
position: relative;
}
.navigation li a:hover {
transform: translateY(10px);
}
.navbar {
margin: 0 auto;
width: 90%;
position: relative;
bottom: 42px;
}
.navcontainer .navbar .rectangle {
background: #f1e5cd;
height: 62px;
position: relative;
-moz-box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.55);
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.55);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
z-index: 500;
/* the stack order: foreground */
margin: 3em 0;
}
.navcontainer .navbar .l-triangle-top {
border-color: #e7dbc3 transparent transparent;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: absolute;
top: 0;
left: -38px;
}
.navcontainer .navbar .l-triangle-bottom {
border-color: transparent transparent #e7dbc3;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: absolute;
top: -38px;
left: -38px;
}
.navcontainer .navbar .r-triangle-top {
border-color: #e7dbc3 transparent transparent;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: absolute;
right: -38px;
top: 0;
}
.navcontainer .navbar .r-triangle-bottom {
border-color: transparent transparent #e7dbc3;
border-style:solid;
border-width:50px;
height:0px;
width:0px;
position: absolute;
top: -38px;
right: -38px;
}
<body>
<div id="background">
<div class="navcontainer">
<div class="navbar">
<!-- the left side of the fork effect -->
<div class="l-triangle-top"></div>
<div class="l-triangle-bottom"></div>
<!-- the ribbon body -->
<div class="rectangle">
<!-- the navigation links -->
<ul class="navigation">
<li>Home
</li>
<li>About
</li>
<li>Menu
</li>
<li>Order
</li>
<li>Contact
</li>
</ul>
<!-- end the ribbon body -->
</div>
<!-- the right side of the fork effect -->
<div class="r-triangle-top"></div>
<div class="r-triangle-bottom"></div>
<!-- end container -->
</div>
</div>
<div class="photocontainer"></div>
</div>
</body>

html <a> not clickable inside menu

I have the following menu, the <a>'s are not clickable, i believe it is a z-index problem but haven't been able to fix it. Also does the html make sense, trying to make a circle with a connected rectangle on the right. Then when it drops down it will be fully connected and filled in. I am using bootstrap 2.3.2.
jsfiddle link
html
<div class="row-fluid">
<div class="span2"></div>
<div class="span7 center"></div>
<div class="span3">
<div class="rightMenu visible-desktop">
<div class="scoreBadge">--</div>
<div class="userBadge"> username ▼
</div>
<ul>
<li> settings
</li>
<li> log out
</li>
</ul>
</div>
</div>
</div>
css
.rightMenu{
position: absolute;
right: 0;
top: 8px;
margin-top: 10px;
min-width: 65px;
}
.rightMenu ul {
display: none;
list-style: none;
text-align: left;
position: relative;
left: -10px;
top: -30px;
background-color: #4b86a1;
color: white;
z-index: -2;
margin-left: 10px;
padding: 20px 10px 10px 10px;
}
.rightMenu ul li {
}
.rightMenu:hover ul {
display: block;
}
.rightMenu ul a {
color: white;
}
.scoreBadge {
display: inline-block;
background: white;
color: #4B86A1;
height: 30px;
width: 30px;
border: 2px solid #fcdf05;
border-radius: 50%;
text-align: center;
line-height: 30px;
vertical-align: middle;
font-size: 18px;
}
.userBadge {
display: inline-block;
background-color: #4b86a1;
vertical-align: middle;
padding-left: 10px;
line-height: 30px;
min-width: 49px;
position: relative;
left: -10px;
-webkit-border-top-right-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
-moz-border-radius-topright: 8px;
-moz-border-radius-bottomright: 8px;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
text-align: right;
z-index: -1;
}
.userBadge > a {
padding: 0 5px 0 5px;
line-height: 25px;
}
#usrName {
color: white;
font-size: 10pt;
font-weight: normal;
text-transform: uppercase;
}
In your css you have
.rightMenu ul {
display: none;
list-style: none;
text-align: left;
position: relative;
left: -10px;
top: -18px;
background-color: #4b86a1;
color: white;
z-index: -2; /* this is the problem */
margin-left: 10px;
padding: 20px 10px 10px 10px;
}
Just remove the - from z-index: -2; and it'll work. Also, without z-index: 2; it seems working fine, so why not just remove the z-index property ? An example here (with z-index:2) and another example (without z-index property).
I solved for you the problem see the change the z-index to 2 in the Class .rightMenu ul