Vertical Connecting Lines with CSS - html

I would like to have a connecting vertical line between each circle. The "Sections" are dynamic in vertical height.
Here is the current SASS:
#import '../sass/sa.common';
$color: $sa-gray-4;
$colorActive: $sa-green;
$colorComplete: $sa-green;
.progress-indicator {
margin-bottom: 50px;
margin-top: 75px;
.step {
margin-top: 40px;
content: "";
display: table;
clear: both;
position: relative;
&:first-child {
margin-top: 0;
}
&:last-child {
div {
&.circle {
&:before {
display: none;
}
}
}
}
&.active {
div {
color: $colorActive;
&.circle {
border-color: $colorActive;
}
a {
color: $colorActive;
}
}
}
&.complete {
div {
color: $colorComplete;
&.circle {
border-color: $colorComplete;
&.filled {
background-color: $colorComplete;
color: $sa-white;
}
}
}
}
div {
color: $color;
display: table-cell;
float: left;
padding-top: 2px;
font-size: 16px;
font-weight: bold;
vertical-align: middle;
&.circle {
height: 30px;
width: 30px;
text-align: center;
border: 2px solid $color;
border-radius: 50%;
&:before {
content: "";
position: absolute;
z-index: 1;
margin-top: 26px;
left: 13px;
border: 1px solid $sa-gray-4;
height: 125%;
}
}
&.text {
padding-left: 10px;
padding-top: 5px;
ul {
margin: 0;
margin-top: 15px;
padding: 0;
list-style-type: none;
li {
a {
display: block;
margin-top: 5px;
&:first-child {
margin-top: 0;
}
}
}
}
}
}
}
}
CSS:
<style type="text/css">#charset "UTF-8";
.btn.btn-green {
background-color: #80b241;
color: #ffffff; }
.btn.btn-green:hover {
background-color: #88bc47; }
.btn.btn-gray-1 {
background-color: #595959;
color: #e7e5e1; }
.btn.btn-gray-1:hover {
background-color: #666666; }
.label.label-green {
background-color: #80b241;
color: #242424; }
.label.label-gray-1 {
background-color: #595959;
color: #ffffff; }
.btn.btn-green {
background-color: #80b241;
color: #ffffff; }
.btn.btn-green:hover {
background-color: #88bc47; }
.btn.btn-gray-1 {
background-color: #595959;
color: #e7e5e1; }
.btn.btn-gray-1:hover {
background-color: #666666; }
.label.label-green {
background-color: #80b241;
color: #242424; }
.label.label-gray-1 {
background-color: #595959;
color: #ffffff; }
.progress-indicator {
margin-bottom: 50px;
margin-top: 75px; }
.progress-indicator .step {
margin-top: 40px;
content: "";
display: table;
clear: both;
position: relative; }
.progress-indicator .step:before {
content: "";
position: absolute;
z-index: 1;
margin-top: 26px;
left: 13px;
border: 1px solid #ADABA6;
height: 125%; }
.progress-indicator .step:first-child {
margin-top: 0; }
.progress-indicator .step:last-child:before {
display: none; }
.progress-indicator .step.active div {
color: #80b241; }
.progress-indicator .step.active div.circle {
border-color: #80b241; }
.progress-indicator .step.active div a {
color: #80b241; }
.progress-indicator .step.complete div {
color: #80b241; }
.progress-indicator .step.complete div.circle {
border-color: #80b241; }
.progress-indicator .step.complete div.circle.filled {
background-color: #80b241;
color: #ffffff; }
.progress-indicator .step div {
color: #ADABA6;
display: table-cell;
float: left;
padding-top: 2px;
font-size: 16px;
font-weight: bold;
vertical-align: middle; }
.progress-indicator .step div.circle {
height: 30px;
width: 30px;
text-align: center;
border: 2px solid #ADABA6;
border-radius: 50%; }
.progress-indicator .step div.text {
padding-left: 10px;
padding-top: 5px; }
.progress-indicator .step div.text ul {
margin: 0;
margin-top: 15px;
padding: 0;
list-style-type: none; }
.progress-indicator .step div.text ul li a {
display: block;
margin-top: 5px; }
.progress-indicator .step div.text ul li a:first-child {
margin-top: 0; }
.category-selector {
margin-top: 30px; }
.category-selector .header {
border-bottom: 2px solid #80b241; }
.category-selector .header:before, .category-selector .header:after {
content: " ";
display: table; }
.category-selector .header:after {
clear: both; }
.category-selector .section-container:before, .category-selector .section-container:after {
content: " ";
display: table; }
.category-selector .section-container:after {
clear: both; }
.category-selector .section-container .section {
float: left;
height: 400px;
min-width: 150px;
overflow-y: scroll; }
.category-selector .section-container .section .item {
border-bottom: 1px solid #80b241;
cursor: pointer;
padding: 5px 10px 5px 5px; }
.category-selector .section-container .section .item:last-child {
border: 0; }
.category-selector .section-container .section .item.active {
background-color: #80b241;
color: #ffffff; }
</style>
And the Markup:
<div class="row">
<div class="col-lg-3">
<div class="progress-indicator">
<div class="step">
<div class="circle">1</div>
<div class="text">Select Category</div>
</div>
<div class="step active">
<div class="circle">2</div>
<div class="text">
Fill Out Listing
<ul>
<li>
Vital Fields
Image Url
Dimensions
</li>
</ul>
</div>
</div>
<div class="step">
<div class="circle">3</div>
<div class="text">Bulk Options</div>
</div>
<div class="step">
<div class="circle">4</div>
<div class="text">More Options</div>
</div>
</div>
<div class="text-center">
<button class="btn btn-default" style="margin-bottom: 10px;">
SAVE AS DRAFT
</button>
<button class="btn btn-gray-1">
MOVE TO PUBLISH QUEUE
</button>
</div>
</div>
<div class="col-lg-6">
<div class="category-selector">
<div class="header">
<div class="pull-left">
<h4>Select a Category</h4>
</div>
<div class="pull-right">
<button class="btn btn-green">Next</button>
</div>
</div>
<div class="section-container">
<div class="section">
<div class="item" [ngClass]="{active: selectedCategory && category.id === selectedCategory.id}" *ngFor="let category of topLevelCategories" (click)="getSubCategories(category)">
{{category.displayName}}
</div>
</div>
<div class="section" *ngIf="subCategories && subCategories.length > 0">
<div class="item" [ngClass]="{active: selectedSubCategory && subCategory.id === selectedSubCategory.id}" *ngFor="let subCategory of subCategories" (click)="getFields(subCategory)">
{{subCategory.displayName}}
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-3">
Side Nav/Slide In
</div>
</div>

Not all browsers honor the display of ::before on elements with display:table. (I have a hunch you are experiencing this in FF? - In Chrome they're displayed). There are two possible fixes:
Either replace display:table with display:flex and display: table-cell with display: block...
...or use proper html elements (divs?) instead of pseudo-elements for lines.
Other notes you might find useful:
remove z-index from .step::before
change height:125% to height:calc(100% + {N}px) where {N} is the difference in px between the actual height of .circle and 40px (top margin of .step). Using this technique you can control exact size of line and match the gap between the circles down to the pixel, thus not needing to hide the extra line length.
Hope the above makes sense and helps. Don't forget to autoprefix.

Something like:
.step {
position: relative;
&:after {
content: "";
position: absolute;
top: 0;
left: 30px; // magic number, try until you get the right positioning
width: 1px;
height: 100%;
border-left: 2px solid $any-color-you-like;
}
}
Make some adjustments, and it should work as you need.

Related

A Section in My HTML is having a problem with its position

I have a site and it has 2 sections. the left section is a navigation bar with menus below.
The section next to it is the main section or where the website content must be placed. My problem is the right section is positioned a few pixels from the header. How can i fix this? I provided some image to let you see how the website should look like.
/*WRITTEN USING SASS*/
#side-menu{
margin-top: 25px;
.side-menu-bg {
width: max-content;
h3 {
position: absolute;
color: white;
padding: 0px 18px;
font-size: 27px;
}
img {
display: -webkit-box;
}
}
.side-nav-bar {
width: 210px;
position: unset;
margin-top: -3px;
display: inline-flex;
z-index: 1;
flex-direction: column;
overflow-x: hidden;
background-color: #ffffff;
a {
display: inherit;
color: #707070;
text-decoration: none;
font-size: 15px;
padding: 10px 18px;
position: relative;
border-bottom: 1px solid #e8e8e8;
}
.active-link{
color: #a40022;
border-bottom: 2px solid #8a001c;
}
}
.right-contents {
float: right;
.title h3 {
font-size: 38px;
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
}
}
<div class="wrapper"> <!--to make contents center-->
<div id="side-menu">
<div class="side-menu-bg">
<h3>KU 스타트업</h3>
<img src="images/bg/bg_03.png">
</div>
<div class="side-nav-bar">
인사말
창업 비전
창업 프로세스
창업부서소개
찾아오시는 길
</div>
<div class="right-contents">
<div class="title">
<h3>인사말</h3>
<div class="body-content">
sample text
</div>
</div>
</div>
</div>
</div>
Add margin: 0 to your h3 tag.. h3 has margin-to and margin-bottom by default. thanks
.right-contents {
float: right;
.title h3 {
font-size: 38px;
margin: 0; /*add this*/
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
<style>
/*WRITTEN USING SASS*/
#side-menu{
margin-top: 25px;
.side-menu-bg {
width: max-content;
h3 {
position: absolute;
color: white;
padding: 0px 18px;
font-size: 27px;
}
img {
display: -webkit-box;
}
}
.side-nav-bar {
width: 210px;
position: unset;
margin-top: -3px;
display: inline-flex;
z-index: 1;
flex-direction: column;
overflow-x: hidden;
background-color: #ffffff;
}
a {
display: inherit;
color: #707070;
text-decoration: none;
font-size: 15px;
padding: 10px 18px;
position: relative;
border-bottom: 1px solid #e8e8e8;
}
.active-link{
color: #a40022;
border-bottom: 2px solid #8a001c;
}
}
.right-contents {
width: 65%;
margin-top: -3px;
display: inline-flex;
.title h3 {
font-size: 38px;
}
.body-content {
background-color: #d3d3d3;
height: 1094px;
width: 738px;
}
</style>

CSS class for fly in transition for javaScript

I need your help using CSS3 transitions. I have some contend I want to fly in from the right to its defined position when hovering. This can be achieved using the CSS in the :hover rule.
However, I want to call this effect from a JavaScript function, so I need your help.
Here is the Code:
#blockcart-wrapper .cart-preview .header {
border: none;
}
#blockcart-wrapper .cart-preview .header .cart-icon {
width: 25px;
height: 28px;
}
.cart-preview {
float: right;
position: relative;
}
.cart-preview a,
.cart-preview a:hover,
.cart-preview a:visited {
text-decoration: none;
color: inherit;
}
.cart-preview .header {
display: block;
font-weight: bold;
border: 1px solid #808080;
padding: 5px;
cursor: pointer;
background-color: #fff;
}
.cart-preview .body {
display: none;
width: 400px;
background-color: #fff;
right: 0;
}
.cart-preview:hover .body {
display: block;
position: absolute;
}
.cart-preview.cart-overview {
width: 100%;
position: inherit;
}
.cart-preview.cart-overview .body {
display: block;
position: inherit;
width: 100%;
}
.cart-preview .header > :first-child {
float: left;
}
.cart-preview .header > :last-child {
float: right;
}
.cart-preview .header::after,
.cart-preview .cart-totals > div::after {
clear: both;
content: "\A0";
}
.cart-preview .body {
border: 1px solid #808080;
padding: 2px;
}
.cart-preview ul {
margin: 0;
padding: 0;
margin-top: 20px;
margin-bottom: 20px;
}
.cart-preview li {
list-style: none;
margin-bottom: 15px;
}
.cart-preview li > * {
display: inline-block;
vertical-align: top;
}
.cart-preview li .product-quantity {
color: #666;
width: 10%;
}
.cart-preview .product-quantity::after {
content: 'x';
}
.cart-preview li .product-name {
width: 50%;
}
.cart-preview li .product-price {
width: 20%;
}
.cart-preview li .remove-from-cart {
text-indent: 100%;
display: inline-block;
overflow: hidden;
vertical-align: middle;
text-decoration: none;
color: inherit;
font-weight: bold;
width: 2em;
white-space: nowrap;
float: right;
}
.cart-preview li .remove-from-cart::before {
content: 'X';
text-indent: 0px;
border: 1px solid #ccc;
border-radius: 100%;
width: 1em;
height: 1em;
padding: 2px;
text-align: center;
background-color: #333;
color: #fff;
float: left;
}
.cart-preview .cart-totals .label {
float: left;
}
.cart-preview .cart-totals .value {
float: right;
}
.cart-preview .cart-totals > div {
clear: both;
border-bottom: 1px solid #ccc;
}
.cart-preview .cart-totals > div:not(:last-child) {
margin-bottom: 5px;
}
.cart-totals .label {
font-weight: bold;
}
#blockcart-modal {
position: fixed;
background-color: rgba(255,255,255,0.1);
top: 0;
left: 0;
bottom: 0;
right: 0;
text-align: center;
}
#blockcart-modal > div {
padding: 20px;
display: inline-block;
min-width: 50%;
min-height: 400px;
margin-top: 200px;
text-align: left;
background-color: #fff;
z-index: 100;
border: 1px solid #ccc;
}
<div id="blockcart-wrapper">
<div class="blockcart cart-preview">
<div class="header">
<a rel="nofollow" href="#">
<img class="cart-icon" src="https://fakeimg.pl/50x50/?text=cart+icon">
</a>
</div>
<div class="body">
<ul>
</ul>
<div class="cart-subtotals">
<div class="products">
<span class="label">Partial sum</span>
<span class="value">0</span>
</div>
<div class="">
<span class="label"></span>
<span class="value"></span>
</div>
<div class="shipping">
<span class="label">Shipping</span>
<span class="value">0</span>
</div>
<div class="">
<span class="label"></span>
<span class="value"></span>
</div>
</div>
<div class="cart-total">
<span class="label">Total sum</span>
<span class="value">0</span>
</div>
</div>
</div>
</div>
So I want to achieve, that the div with class body flies in from the right to its determined position using an own class so I can toggle the class by a JavaScript if a certain external event is triggered and the class should only contain the transition effect, so the browser does the 'reverse transition' when the hover is stopped or the class is removed by a JavaScript function.
Can you help me here?
The css should be just like you would do if using :hover, just instead of :hover add a class to the selector (a.hovered), and use js mouseover and mouseout events to toggle this class.
CSS -
div.body.hovered {
right: 300px; /*or however you meant to do the transition*/
}
JS -
var elements = document.getElementsByClass('body');
elements.addEventListener("mouseover", function( event ) {
this.classList.add('hovered');
});
elements.addEventListener("mouseout", function( event ) {
this.classList.remove('hovered');
});

How to add image on hover in <li>::after

I want a structure like this on <li> hover (Blue down arrow on center of every li)
But I'm unable to make this because i thought i will use this blue image as pseudo elements ::after but i have added ":" in between two <li>.
This is my html code :
<div class="quick-links col-md-12">
<p class="left" style="font-weight:600;font-family:calibri;">Go quickly
to</p>
<i class="fa fa-arrow-circle-right" style="color:#2ca5fa;padding:0px 3px 0px 12px;"></i>
<ul class="quick-ul">
<li>Mobiles</li>
<li>Sports</li>
<li>Tablets</li>
<li>Bath Towels</li>
<li>LED Bulbs</li>
<li>TV</li>
<li>Washing Machines</li>
<li>Laptops</li>
<li>Headphones</li>
<li>Fans</li>
<li>Travel</li>
<li>Books</li>
</ul>
</div>
This is my CSS code :
.quick-links {
height: 52px;
background-color: white;
margin-top: 20px;
display: inline-table;
padding-top: 13px;
border-top: 4px solid #0096ff;
}
.left {
float: left;
}
.quick-ul {
float: right;
display: inline-flex;
}
.quick-ul li {
font-family: calibri;
padding-right: 39px;
position: relative;
margin-left: -34px;
font-size: 15px;
}
.quick-ul li>a {
color: black;
}
.quick-ul li>a:hover {
color: #0096ff;
}
.quick-ul li::after {
content: ":";
color: black;
padding-left: 10px;
padding-right: 10px;
font-weight: 100 !important;
}
.quick-ul li:nth-last-child(1)::after{
content: "";
}
Any Kind of help would be highly appreciated.
All you need is this rule
.quick-ul li>a:hover::after
content: "\25bc";
position: absolute;
left: 50%;
top: 0;
transform: translate(-50%, -100%) scaleX(2);
color: #0096ff;
font-size: 20px;
}
It will add a filled arrow character using the pseudo ::after, that is easily colored and sized as any other character. The translate moves it into place and the scaleX makes it a little wider.
Stack snippet
.quick-links {
height: 52px;
background-color: white;
margin-top: 20px;
display: inline-table;
border-top: 4px solid #0096ff;
}
.left {
float: left;
}
.quick-ul {
float: right;
display: inline-flex;
list-style: none; /* added property */
}
.quick-ul li {
font-family: calibri;
padding-right: 39px;
position: relative;
margin-left: -34px;
font-size: 15px;
}
.quick-ul li>a {
color: black;
}
.quick-ul li>a:hover {
position: relative; /* added property */
color: #0096ff;
}
.quick-ul li>a:hover::after { /* added rule */
content: "\25bc";
position: absolute;
left: 50%;
top: 0;
transform: translate(-50%, -100%) scaleX(2);
color: #0096ff;
font-size: 20px;
}
.quick-ul li::after {
content: ":";
color: black;
padding-left: 10px;
padding-right: 10px;
font-weight: 100 !important;
}
.quick-ul li:nth-last-child(1)::after {
content: "";
}
<div class="quick-links col-md-12">
<p class="left" style="font-weight:600;font-family:calibri;">Go quickly to
</p>
<i class="fa fa-arrow-circle-right" style="color:#2ca5fa;padding:0px 3px 0px 12px;"></i>
<ul class="quick-ul">
<li>Mobiles</li>
<li>Sports</li>
<li>Tablets</li>
<li>Bath Towels</li>
<li>LED Bulbs</li>
<li>TV</li>
</ul>
</div>
Try this.
.quick-links {
height: 52px;
background-color: white;
margin-top: 20px;
display: inline-table;
padding-top: 0;
border-top: 4px solid #0096ff;
}
.left {
float: left;
}
.quick-ul {
list-style: none;
float: right;
display: inline-flex;
}
.quick-ul li {
font-family: calibri;
font-size: 15px;
position: relative;
}
.quick-ul li>a {
color: black;
position: relative;
}
.quick-ul li>a:hover {
color: #0096ff;
}
.quick-ul li::after {
content: ":";
color: black;
padding-left: 10px;
padding-right: 10px;
font-weight: 100 !important;
}
.quick-ul li:nth-last-child(1)::after {
content: "";
}
/* additional styles */
.quick-ul li a::before {
content: "";
position: absolute;
top: -17px;
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
border-top: 10px solid #0096ff;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
opacity: 0;
transition: all ease 0.15s;
}
.quick-ul li:hover a::before {
opacity: 1;
}
<div class="quick-links col-md-12">
<p class="left" style="font-weight:600;font-family:calibri;">Go quickly to
</p>
<i class="fa fa-arrow-circle-right" style="color:#2ca5fa;padding:0px 3px 0px 12px;"></i>
<ul class="quick-ul">
<li>Mobiles</li>
<li>Sports</li>
<li>Tablets</li>
<li>Bath Towels</li>
<li>LED Bulbs</li>
</ul>
</div>
This code should work for you:
.quick-links {
height: 52px;
background-color: white;
margin-top: 20px;
border-top: 4px solid #0096ff;
text-align: center;
padding: 0px !important;
}
.left {
float: left;
}
.quick-ul {
list-style: none;
display: flex;
justify-content: center;
margin: 0px;
box-sizing: border-box;
}
.quick-ul li {
position: relative;
font-family: Arial;
padding: 0px;
font-size: 15px;
margin: 0px 1px;
display: inline;
box-sizing: border-box;
}
.quick-ul li:not(:last-child)::before {
content: ":";
position: absolute;
top: 30%;
right: 0px;
height: 100%;
width: auto;
}
.quick-ul li>a {
display: block;
width: 100%;
height: 100%;
color: blue;
padding: 12px 18px 0px;
box-sizing: border-box;
position: relative;
}
.quick-ul li>a:hover {
color: #0096ff;
}
.quick-ul li > a::after {
display: block;
content: "";
color: blue;
padding-left: 10px;
padding-right: 10px;
font-weight: 100 !important;
transform: rotate(90deg);
transform: translateX(-50%) rotate(90deg);
margin-top: -5px;
font-size: 18px;
position: absolute;
top: 0px; left: 50%;
transition: all 0.3s ease-in-out;
}
.quick-ul li>a:hover::after {content: '\25B6'}
<div class="quick-links col-md-12">
<ul class="quick-ul">
<li>Mobiles</li>
<li>Sports</li>
<li>Tablets</li>
</ul>

My CSS Grid is not Working with my HTML

I have been working on a grid system for a practice website for about two weeks now and I still can't figure it out. I have been watching youtube videos and reading articles left and right with no luck. This is what I have come up with thus far:
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #2A2A2A;
border-top: 1px solid black;
border-bottom: 1px solid black;
}
li {
float: right;
text-color: white;
border-left: 1px solid white;
font-family: "Comic Sans MS";
}
li:hover {
background-color: #1D1D1D;
}
li a {
display: block;
padding: 8px;
color: white;
margin: 7px 5px 7px 5px;
}
li a:hover {
background-color: #1D1D1D;
color: white;
text-decoration: none;
}
li:first-child {
background-color: #00E006;
border: none
}
li:first-child:hover {
background-color: #05aa0a;
}
li:first-child a:hover {
background-color: #05aa0a;
}
.fit {
max-width: 100%;
max-height: 100%;
}
.background {
background-color: grey;
}
p {
color: black;
font-family: "Trebuchet MS";
font-size: 16px;
margin: 10px;
}
a:hover {
text-decoration: none;
}
.bigger-text {
font-size: 20px;
}
.profile-img-border {
border: 1px solid black;
border-radius: 50%;
}
.img-border {
border: 3px solid black;
border-radius: 100%;
margin: 5px
}
div.img {
margin: 0 auto;
border: 1px solid #ccc;
float: left;
width: 280px;
display: block;
}
div.img:hover {
border: 1px solid #777;
}
div.img img {
width: 100%;
height: auto;
}
div.desc {
padding: 15px;
text-align: center;
background-color: white;
}
.container {
width: 1460px;
margin-right: auto;
margin-left:auto
}
five:first-child, four:first-child, three:first-child, two:first-child, one:first-child, six:first-child {
margin-left: 0;
}
.six {
width: 100%;
display: block;
}
.five {
width: 80%;
display: block;
float: left;
margin-left: 2%;
}
.four {
width: 66%;
display: block;
float: left;
margin-left: 2%;
}
.three {
width: 49%;
display: block;
float: left;
margin-left: 2%;
}
.two {
width: 32%;
display: block;
float: left;
margin-left: 2%;
}
.one {
width: 15%;
display: block;
float: left;
margin-left: 2%;
}
.row {
width: 100%;
clear: both;
padding: 0px;
margin: 0px;
}
<!DOCTYPE html>
<html>
<head>
<Title>Personal Portfolio FCC</Title>
<link rel="stylesheet" href="Hello%20World.css">
</head>
<body class="background">
<div class="container">
<div class="row">
<div class="top-bar-box align-middle-v" align="right">
<ul>
<li style="float:left">
<a class="active">Home</a>
</li>
<li><a>About</a></li>
<li><a>Portfolio</a></li>
<li><a>Contact</a></li>
</ul>
</div>
</div><!--Row 1 closer-->
<div class="row"><!--Row 2 opener-->
<div class="four">
<p>"text text text"</p>
</div>
<div class="two">
<img src="#" alt="A picture of a verry handsome
fellow(me)" class="profile-img-border"></img>
</div>
</div><!--Row 2 closer-->
</div>
</body>
</html>
you could start by moving this to the end
five:first-child,
four:first-child,
three:first-child,
two:first-child,
one:first-child,
six:first-child {
margin-left: 0;
}
and replacing it with
.five:first-child,
.four:first-child,
.three:first-child,
.two:first-child,
.one:first-child,
.six:first-child {
margin-left: 0;
}

CSS issue with an image

How to make.
.l {
float: left
}
.abs {
position: absolute
}
.rl {
position: relative
}
.r {
float: right
}
.f {
clear: both
}
.menuItem {
border-bottom: 1px #ccc solid
}
.menuItem .p {
padding: 10px 10px;
font-weight: bold;
font-size: 12px
}
.menuItem .active {
color: #333;
cursor: default
}
.menuItem a {
display: block;
text-decoration: none;
cursor: pointer
}
.menuItem .p:hover {
background-color: #f5f5f6;
text-decoration: none
}
<div class='menuItem'>
<div class='l' style='margin-left:120px'> </div>
<div class='l p active'>Info
</div>
<a href="<% $URL %><% $_GET[0] %>/forums">
<div class='l p'>Forums (105)</div>
</a>
<div class='f'></div>
</div>
http://jsfiddle.net/AndyPSV/6gh2dfm4/1/
Image under (center position) .active as such:
(white background, consistent with the border_bottom)
and background: #fff when you hover on ALL active?
An easy solution would be to create a small image of a triangle and to use the background css property on the class .active to position that image in the middle of the bottom. When hovering over the .active you can set the background to none. For example:
.active {
background: url('http://placehold.it/9x9') center bottom no-repeat;
}
.active:hover {
background: none;
}
Another option might be not to use an image at all and to use create a triangle in a :after selector using css.
.l {
float: left
}
.abs {
position: absolute
}
.rl {
position: relative
}
.r {
float: right
}
.f {
clear: both
}
.menuItem {
border-bottom: 1px #ccc solid
}
.menuItem .p {
padding: 10px 10px;
font-weight: bold;
font-size: 12px
}
.menuItem .active {
color: #333;
cursor: default
}
.menuItem a {
display: block;
text-decoration: none;
cursor: pointer
}
.menuItem .p:hover {
background-color: #f5f5f6;
text-decoration: none
}
.active {
background: url('http://placehold.it/9x9') center bottom no-repeat;
}
.active:hover {
background: none;
}
<div class='menuItem'>
<div class='l' style='margin-left:120px'> </div>
<div class='l p active'>Info
</div>
<a href="<% $URL %><% $_GET[0] %>/forums">
<div class='l p'>Forums (105)</div>
</a>
<div class='f'></div>
</div>
you can use :pseudo element for adding triangle at the bottom
.l {
float: left;
position: relative;
}
.abs {
position: absolute
}
.rl {
position: relative
}
.r {
float: right
}
.f {
clear: both
}
.menuItem {
border-bottom: 1px #ccc solid
}
.menuItem .p {
padding: 10px 10px;
font-weight: bold;
font-size: 12px
}
.menuItem .active {
color: #333;
cursor: default
}
.menuItem a {
display: block;
text-decoration: none;
cursor: pointer
}
.menuItem .p:hover {
background-color: #f5f5f6;
text-decoration: none
}
.l.active:after {
content: '';
bottom: -1px;
width: 0;
height: 0;
position: absolute;
border-style: solid;
border-width: 0px 9px 10px 9px;
border-color: rgb(233, 234, 237) transparent;
left: 50%;
margin-left: -11px;
}
.l.active:before {
content: '';
bottom: -1px;
width: 0;
height: 0;
position: absolute;
border-style: solid;
border-width: 0px 10px 11px 10px;
border-color: #ccc transparent;
left: 50%;
margin-left: -12px;
}
<div class='menuItem'>
<div class='l' style='margin-left:120px'> </div>
<div class='l p active'>Info
</div>
<a href="<% $URL %><% $_GET[0] %>/forums">
<div class='l p'>Forums (105)</div>
</a>
<div class='f'></div>
</div>