CSS Chevron like element WITH border and shadows after li element - html

I'm trying to create Tabbed Contents with some border and shadows.
This is slightly different from on questions in that I'm trying to create shadows. Additionally, the whole area of the tab should be clickable. Basically a complex div inside an anchor tag in a li
Attempt 1
Used a square box and rotated it with two border widths visible.
What I have now:
What I am wishing to obtain when a tab is opened/active (using CSS only):
Attempt 2
Used a right pointing triangle after every li element.
Positioned it just before next li element
Failed at the white padding in between (that could be fixed with margin between two li) but could not find a possible solution for shadow.
Attempt 3
Positioned colored right pointed triangle after an element
Positioned white triangle behind it and :before the next li element.
Shadows scared me this time.
So basically the problems are the tail of next li element and the shadow of the chevron of current element.
Demo of Attempt in Stack Snippets
.my-tabs {
width: 100%;
margin: 10px 0 !important;
display: flex;
overflow: hidden;
position: relative;
z-index: 100;
padding-top: 10px;
}
.my-tabs li a {
padding: 15px 20px 15px 50px;
background: #ff5050;
display: block;
height: 56px;
}
.my-tabs li {
display: block;
width: 20%;
font-size: 1.1em;
margin: 0;
}
.my-tabs li:last-child:after {
border-top: 28px solid #fff;
border-left: 28px solid transparent;
margin-right: 0;
border-style: solid;
border-right: 0;
border-bottom: 28px solid #fff;
content: '';
height: 0;
float: right;
margin-top: -56px;
transform: none;
width: 0;
}
.my-tabs:after {
border-left: 40px solid #ff5050 !important;
margin-top: 1px;
margin-left: -2px;
}
.my-tabs li:after {
margin-right: -7px;
border-style: solid;
border-width: 4px 4px 0 0;
border-color: white;
content: '';
height: 43px;
float: right;
margin-top: -43px;
transform-origin: center top;
transform: rotate(45deg);
width: 43px;
}
.my-tabs li.active:after {
-webkit-box-shadow: 8px 0px 4px -3px #090A09;
-moz-box-shadow: 8px 0px 4px -3px #090A09;
-o-box-shadow: 8px 0px 4px -3px #090A09;
box-shadow: 8px 0px 4px -3px #090A09;
}
.my-tabs li.active {
border-bottom: 8px solid white;
}
.my-tabs li.active a {
-webkit-box-shadow: 0px 8px 4px -3px #090A09;
-moz-box-shadow: 0px 8px 4px -3px #090A09;
-o-box-shadow: 0px 8px 4px -3px #090A09;
box-shadow: 0px 8px 4px -3px #090A09;
}
<ul class="my-tabs">
<li id="gtab0" class="">tab1</li>
<li id="gtab1" class="">tab2</li>
<li id="gtab2" class="active">tab3'</li>
<li id="gtab3" class="">tab4</li>
<li id="gtab4" class="">tab5</li>
</ul>

Here is a live demo for your need.
Just before, some notes:
You need to wrap the text inside the arrows in div like this: <div>Tab 1</div> because the div is hide the :after element box-shadow. (To understand this, try to unwrap the div.
You need to set their z-index in descending order, so the first one hides the second and so on. (I believe that there are no many arrows so I took a guess to maximum 5)
I added a :hover transition to the box-shadow so you can see how to do this if you want.
After the talks, here is the real thing:
ul {
list-style:none;
padding:0;
margin:0;
}
li {
display:inline-block;
background:#2980b9;
color:#fff;
position:relative;
box-shadow: 0 2px 3px 0 rgba(0,0,0,0.5);
transition:all .3s ease;
cursor:pointer;
}
li:after {
content: "";
position: absolute;
top: 0;
right: -14px;
height: 26px;
width: 26px;
background: inherit;
transform: translateY(6px) rotate(45deg);
box-shadow: 2px 1px 3px 0 rgba(0,0,0,0.5);
transition:all .3s ease;
}
li:nth-child(1) {
z-index:5;
}
li:nth-child(2) {
z-index:4;
}
li:nth-child(3) {
z-index:3;
}
li:nth-child(4) {
z-index:2;
}
li:nth-child(5) {
z-index:1;
}
li:hover {
box-shadow: 0 2px 1px 0 rgba(0,0,0,0.3);
}
li:before:hover {
box-shadow: 2px 1px 1px 0 rgba(0,0,0,0.3);
}
li.active {
background:#c0392b;
}
li div {
background:inherit;
padding:10px 20px;
position:relative;
z-index:1;
}
<ul>
<li><div>Tab 1</div></li>
<li class="active"><div>Tab 2</div></li>
</ul>
http://jsbin.com/fedepe
Update
The other option to create this shape is using SVG.
Just note that this is a quick and dirty solution. With svg you can't say "I can't do this". Just take this code, play with it, until you will get the exact result that you want.
I'm using the use (info) tag so you don't need to duplicate many (svg) code to each of the items.
I'm using filter:drop-shadow for the shadow (obviously, info).
You can edit this shape using apps like Adobe Illustrator or similar.
* {
color:#fff;
}
ul {
list-style:none;
padding:0;
margin:0;
}
li {
position: relative;
padding: 10px 50px 10px 25px;
float: left;
}
svg {
position:absolute;
left:0;
top:0;
height:100%;
z-index:-1;
-webkit-filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.5));
filter: drop-shadow(12px 12px 7px rgba(0,0,0,0.5));
}
use.reg {
fill:red;
}
use.active {
fill: blue;
}
.hidden {
display:none;
}
li:first-child {
z-index:1;
}
<svg class="hidden" xmlns="http://www.w3.org/2000/svg" width="148.978px" height="41.791px" viewBox="0.522 375.104 148.978 41.791">
<defs>
<g id="aa" transform="translate(0.000000,240.000000) scale(0.100000,-0.100000)">
<path d="M5.225-1766.523c0-2.09,81.318-2.432,590.644-2.432h590.82c0,0,298.311,205.298,298.311,209.653
c0,4.351-292.207,204.253-292.207,205.645c0,2.266-74.014,2.612-593.789,2.612c-451.167,0-593.779-0.522-593.779-2.09"/>
</g>
</defs>
</svg>
<ul>
<li>
Item 1
<svg viewBox="0.522 375.104 148.978 41.791">
<use class="reg" xlink:href="#aa"></use>
</svg>
</li>
<li>
Item 2
<svg viewBox="0.522 375.104 148.978 41.791">
<use class="active" xlink:href="#aa"></use>
</svg>
</li>
</ul>
http://jsbin.com/texasu

If you have some time to spend, you could relay on background linear gradient and rgba colors hover a single texture: demo
sample of snippet below:
.active {
background: linear-gradient(-310deg, transparent 0.75em, rgba(0, 100, 255, 0.5) 0.75em) top left no-repeat, linear-gradient(125deg, transparent 0.5em, rgba(0, 100, 255, 0.5) 10px) bottom left no-repeat;
background-size: 100% 50%, 100% 50%
}
ul {
background: url(http://lorempixel.com/500/52/abstract/4);
overflow: hidden;
border-bottom:3px solid transparent;
padding:0 0 3px 0;
margin:1em;
background-clip:content-box;
}
ul:before {
content:'';
height:1.9em;
display:inline-block;
border-right:solid white;
position:relative;
vertical-align:top;
}
li {
margin: 0;
padding: 0;
list-style-type: none;
}
li {
display: inline-block;
vertical-align: top;
text-align: center;
min-width: 70px;
padding: 0.25em 2em 0.25em 1.5em;
border: 2px solid white;
border-right: none;
border-left: none;
}
li:before {
content: '';
padding: 0.7em;
margin: -0.25em -2.75em -0.5em 2em;
border: solid white;
border-left: none;
border-bottom: none;
float: right;
transform: rotate(45deg);
border-radius: 2px;
/* ? */
}
li:first-of-type {
margin-left: -1em;
}
.active {
background: linear-gradient(-310deg, transparent 0.75em, rgba(0, 100, 255, 0.5) 0.75em) top left no-repeat, linear-gradient(125deg, transparent 0.5em, rgba(0, 100, 255, 0.5) 10px) bottom left no-repeat;
background-size: 100% 50%, 100% 50%;
box-shadow:0 2px 2px black;
}
.active:before {
background: linear-gradient(45deg, transparent 56%, rgba(0, 100, 255, 0.5) 56%);
box-shadow:3px 0px 2px black;
}
li:last-of-type {
background: linear-gradient(-310deg,transparent 0.75em, rgba(200, 0, 0, 0.5) 0.75em) top left no-repeat, linear-gradient(125deg, transparent 0.5em, rgba(200, 0, 0, 0.5) 10px) bottom left no-repeat;
background-size: 100% 50%, 100% 50%
}
li:last-of-type:before {
background: linear-gradient(45deg, transparent 56%, rgba(200, 0, 0, 0.5) 56%)
}
li:hover {
background: linear-gradient(-310deg,transparent 0.75em, rgba(0, 100, 0, 0.5) 0.75em) top left no-repeat, linear-gradient(125deg, transparent 0.5em, rgba(0, 100, 0, 0.5) 10px) bottom left no-repeat;
background-size: 100% 50%, 100% 50%;
box-shadow:0px 2px 2px black;
}
li:hover:before {
background: linear-gradient(45deg, transparent 56%, rgba(0, 100, 0, 0.5) 56%);
box-shadow:3px 0px 2px black;
}
a {
color:#12374B;
font-weight:bold;
text-shadow:0 0 1px white;
font-variant:small-caps;
}
body {
background:#777;
}
<ul>
<li class="active">Qualify</li><li>
Develop</li><li>
Propose</li><li class="active">
Qualify</li><li>
Close</li>
</ul>
with nav + a
nav {
background: url(http://lorempixel.com/500/52/abstract/4);
overflow: hidden;
border-bottom:3px solid transparent;
padding:0 0 3px 0;
margin:1em;
background-clip:content-box;
white-space:nowrap; /* keep it on a single line */
}
nav:before {
content:'';
height:1.9em;
display:inline-block;
border-right:solid white;
position:relative;
vertical-align:top;
}
a {
margin: 0;
padding: 0;
list-style-type: none;
}
a {
display: inline-block;
vertical-align: top;
text-align: center;
min-width: 70px;
padding: 0.25em 2em 0.25em 1.5em;
border: 2px solid white;
border-right: none;
border-left: none;
}
a:before {
content: '';
padding: 0.7em;
margin: -0.25em -2.75em -0.5em 2em;
border: solid white;
border-left: none;
border-bottom: none;
float: right;
transform: rotate(45deg);
border-radius: 2px;
/* ? */
}
a:first-of-type {
margin-left: -1em;
}
.active {
background: linear-gradient(-310deg, transparent 0.75em, rgba(0, 100, 255, 0.5) 0.75em) top left no-repeat, linear-gradient(125deg, transparent 0.5em, rgba(0, 100, 255, 0.5) 10px) bottom left no-repeat;
background-size: 100% 50%, 100% 50%;
box-shadow:0 2px 2px black;
}
.active:before {
background: linear-gradient(45deg, transparent 56%, rgba(0, 100, 255, 0.5) 56%);
box-shadow:3px 0px 2px black;
}
a:last-of-type {
background: linear-gradient(-310deg,transparent 0.75em, rgba(200, 0, 0, 0.5) 0.75em) top left no-repeat, linear-gradient(125deg, transparent 0.5em, rgba(200, 0, 0, 0.5) 10px) bottom left no-repeat;
background-size: 100% 50%, 100% 50%
}
a:last-of-type:before {
background: linear-gradient(45deg, transparent 56%, rgba(200, 0, 0, 0.5) 56%)
}
a:hover {
background: linear-gradient(-310deg,transparent 0.75em, rgba(0, 100, 0, 0.5) 0.75em) top left no-repeat, linear-gradient(125deg, transparent 0.5em, rgba(0, 100, 0, 0.5) 10px) bottom left no-repeat;
background-size: 100% 50%, 100% 50%;
box-shadow:0px 2px 2px black;
}
a:hover:before {
background: linear-gradient(45deg, transparent 56%, rgba(0, 100, 0, 0.5) 56%);
box-shadow:3px 0px 2px black;
}
a {
color:#12374B;
font-weight:bold;
text-shadow:0 0 1px white;
font-variant:small-caps;
}
body {
background:#777;
}
<nav>
Qualify<!-- white space can be killed here or else where if this method is not apprpriate to your coding
-->Develop<!--
-->Propose<!--
-->Qualify<!--
-->Close
</nav>

Related

How to have Text-Shadow with Webkit gradient

When I use Text-Shadow with Webkit gradient, it appears to be on top of the text - instead of behind. I increased the shadow opacity to show this.
#title {
font-size: calc(15px + 9vw);
text-align: center;
background: linear-gradient(to right, red 0%, blue 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-top: 8vh;
text-shadow: -10px 15px 5px rgba(0,0,0,0.1),
-10px 20px 5px rgba(0,0,0,1),
-10px 20px 5px rgba(0,0,0,1);
}
<h3 id="title">Example</h3>
And idea is to create another layer with pseudo-element that you put behind.
#title {
font-size: calc(15px + 9vw);
text-align: center;
background: linear-gradient(to right, red 0%, blue 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-top: 8vh;
position:relative;
}
#title:before {
content:attr(data-text);
position:absolute;
top:0;
right:0;
left:0;
bottom:0;
text-shadow: -10px 15px 5px rgba(0,0,0,0.1),
-10px 20px 5px rgba(0,0,0,1),
-10px 20px 5px rgba(0,0,0,1);
z-index:-1
}
<h3 id="title" data-text="Example">Example</h3>
And if you don't want to duplicate the text you can use both pseudo-element and define the text only in the attribute:
#title {
position: relative;
text-align: center;
margin-top: 8vh;
font-size: calc(15px + 9vw);
z-index: 0;
}
#title:before {
content: attr(data-text);
position: relative;
background: linear-gradient(to right, red 0%, blue 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
z-index: 1;
}
#title:after {
content: attr(data-text);
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
text-shadow:
-10px 15px 5px rgba(0, 0, 0, 0.1),
-10px 20px 5px rgba(0, 0, 0, 1),
-10px 20px 5px rgba(0, 0, 0, 1);
z-index: -1;
}
<h3 id="title" data-text="Example"></h3>

Numbers keep showing up

For some unknown reason, numbers keep showing up on the side of my div. I have tried everything to remove these numbers, but I have absolutely no idea where they appear from. I do know that it has to do with either the stylesheet or the html file. I provided the image below.
Also, "Vitalynx" is shifted all the way to the right and i cannot shift it back in the div with margin-left.. Any ideas? Help would be much appreciated!
leaderboard
Here's the html code:
<div id="ld">
<div class="leaderboard">
<h1>
Most active Players
</h1>
<ol>
<?= $fgmembersite->User1(); ?>
<?= $fgmembersite->User10(); ?>
</ol>
</div>
</div>
<br><br>
Here's the CSS:
/*--------------------
Leaderboard
--------------------*/
.ld h1 {
z-index: 0;
margin-top: -20px;
margin: -20px -5px 4px;
line-height: 40px;
text-shadow: 2px 1px 3px rgba(0,0,0,0.3);
font-weight: bold;
font: 23px "Lucida Grande", Tahoma, Verdana, sans-serif;
color: white;
text-align: center;
background: #12a7ee;
border-bottom: 0px solid #cfcfcf;
border-radius: 5px 5px;
-webkit-box-shadow: 3px 1px whitesmoke;
border-left:solid 0px #2ab7ec;
margin-left: 0px;
background-image: linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -o-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -moz-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -ms-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(44,160,202)),
color-stop(1, rgb(62,184,229))
);
border-radius: 6px;
-webkit-box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #0c7095, 0px 10px 5px #999;
-moz-box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #156785, 0px 10px 5px #999;
-o-box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #156785, 0px 10px 5px #999;
box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #0c7095, 0px 10px 5px #999;
}
.leaderboard *,
.leaderboard *::before,
.leaderboard *::after {
box-sizing: border-box;
}
.leaderboard {
position: relative;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, 5%);
width: 245px;
height: 335px;
background-color: white;
background-color: #white;
border-radius: 10px;
box-shadow: 0 7px 30px rgba(62, 9, 11, 0.3);
}
.leaderboard h1 {
margin: -20px -2.8px 5px;
line-height: 40px;
text-shadow: 2px 1px 3px rgba(0,0,0,0.3);
font-weight: bold;
font: 23px "Lucida Grande", Tahoma, Verdana, sans-serif;
color: #fff;
text-align: center;
background: #12a7ee;
border-bottom: 0px solid #cfcfcf;
border-radius: 5px 5px;
-webkit-box-shadow: 3px 1px whitesmoke;
border-left:solid 0px #2ab7ec;
margin-left: -17.7px;
background-image: linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -o-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -moz-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -ms-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(44,160,202)),
color-stop(1, rgb(62,184,229))
);
border-radius: 6px;
-webkit-box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #0c7095, 0px 10px 5px #999;
-moz-box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #156785, 0px 10px 5px #999;
-o-box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #156785, 0px 10px 5px #999;
box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #0c7095, 0px 10px 5px #999;
margin-left: -3px;
z-index: 0;
font-size: 18px;
color: #fffff;
padding: 12px 13px 15px;
}
.leaderboard h1 svg {
width: 25px;
height: 26px;
position: relative;
top: 3px;
margin-left: -30px;
vertical-align: baseline;
}
.leaderboard ol li {
margin-left: -22px;
position: relative;
z-index: 1;
font-size: 14px;
counter-increment: leaderboard;
padding: 18px 0px 23px 245px;
cursor: pointer;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-transform: translateZ(0) scale(1, 1);
transform: translateZ(0) scale(1, 1);
}
.leaderboard ol li::before {
position: absolute;
z-index: 2;
top: 15px;
left: 15px;
width: 20px;
height: 20px;
line-height: 20px;
color: #2b70ab;
background: #fff;
border-radius: 20px;
text-align: center;
}
.leaderboard ol li mark {
position: absolute;
text-shadow: 1px 3px 3px rgba(0,0,0,0.3);
z-index: 2;
top: 0;
left: -4px;
width: 100%;
height: 100%;
padding: 18px 10px 18px 50px;
margin: 0;
background: none;
color: #fff;
}
.leaderboard ol li mark::before, .leaderboard ol li mark::after {
position: absolute;
z-index: 1;
bottom: -11px;
left: -9px;
border-top: 10px solid #563689;
border-left: 10px solid transparent;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
opacity: 0;
}
.leaderboard ol li mark::after {
left: auto;
right: -9px;
border-left: none;
border-right: 10px solid transparent;
}
#d {
text-decoration: underline;
}
#e {
margin-left: -40px;
color: #fff;
text-shadow: 1px 3px 3px rgba(0,0,0,0.2);
}
.leaderboard ol li small {
position: relative;
text-shadow: 1px 3px 3px rgba(0,0,0,0.8);
font-size: 13px;
margin-left: -34px;
z-index: 2;
display: block;
color: #05eccc;
}
.leaderboard ol li::after {
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
-webkit-transition: all .3s ease-in-out;
transition: all .3s ease-in-out;
opacity: 0;
}
.leaderboard ol li:nth-child(1) {
background: #82d1a1;
}
.leaderboard ol li:nth-child(1)::after {
background: #ac918e;
}
.leaderboard ol li:nth-child(2) {
background: #1bb288;
}
.leaderboard ol li:nth-child(2)::after {
background: #b79a98;
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}
.leaderboard ol li:nth-child(2) mark::before, .leaderboard ol li:nth-child(2) mark::after {
border-top: 6px solid #ba4741;
bottom: -7px;
}
.leaderboard ol li:nth-child(3) {
background: #119c75;
}
.leaderboard ol li:nth-child(3)::after {
/* background: #d7514d; */
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.11);
}
.leaderboard ol li:nth-child(3) mark::before, .leaderboard ol li:nth-child(3) mark::after {
bottom: -3px;
}
.leaderboard ol li:nth-child(4) {
background: #108363;
}
.leaderboard ol li:nth-child(4)::after {
background: #cd4b4b;
box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.15);
}
.leaderboard ol li:nth-child(4) mark::before, .leaderboard ol li:nth-child(4) mark::after {
top: -7px;
bottom: auto;
border-top: none;
border-bottom: 6px;
}
.leaderboard ol li:nth-child(5) {
background: #0c7558;
border-radius: 0 0 10px 10px;
}
.leaderboard ol li:nth-child(5)::after {
background: #c24448;
margin-top: -20px;
margin: -21px -16.8px 5px;
line-height: 40px;
text-shadow: 2px 1px 3px rgba(0,0,0,0.3);
font-weight: bold;
font: 23px "Lucida Grande", Tahoma, Verdana, sans-serif;
color: #fff;
text-align: center;
background: #12a7ee;
border-bottom: 0px solid #cfcfcf;
border-radius: 5px 5px;
-webkit-box-shadow: 3px 1px whitesmoke;
border-left:solid 0px #2ab7ec;
margin-left: -17.7px;
background-image: linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -o-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -moz-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -ms-linear-gradient(bottom, rgb(44,160,202) 0%, rgb(62,184,229) 100%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0, rgb(44,160,202)),
color-stop(1, rgb(62,184,229))
);
border-radius: 6px;
-webkit-box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #0c7095, 0px 10px 5px #999;
-moz-box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #156785, 0px 10px 5px #999;
-o-box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #156785, 0px 10px 5px #999;
box-shadow: inset 0px 1px 0px #2ab7ec, 0px 5px 0px 0px #0c7095, 0px 10px 5px #999;
}
.leaderboard ol li:nth-child(5) mark::before, .leaderboard ol li:nth-child(5) mark::after {
top: -9px;
bottom: auto;
border-top: none;
border-bottom: 8px;
}
.leaderboard ol li:hover {
z-index: 2;
overflow: visible;
}
.leaderboard ol li:hover::after {
opacity: 1;
-webkit-transform: scaleX(1.06) scaleY(1.03);
transform: scaleX(1.06) scaleY(1.03);
}
.leaderboard ol li:hover mark::before, .leaderboard ol li:hover mark::after {
opacity: 1;
-webkit-transition: all .35s ease-in-out;
transition: all .35s ease-in-out;
}
<ol> is the tag for an Ordered List, and so by default it will have numbers. If you'd like to remove them, do the following:
ol {
list-style-type:none;
}
In regards to your alignment issue, it seems that your right column text is left-aligned. I'd suggest making that text right-aligned, and the container would have to be positioned along the right hand side. Based on your structure, potential solutions would either be using position: absolute; right: 5px; on the text element, and then a position: relative on its parent or you could use float: right;, though I'd only suggest this method if you're familiar with how float works in general.
Your CSS is far too lengthy at this point for me to start digging through for an exact answer. Consider trimming it or posting only the relevant blocks and I can take a better look.
If I had to guess, I'd assume this is the block you're using to place the right column:
.leaderboard ol li {
...
margin-left: -22px;
padding: 18px 0px 23px 245px;
...
}
You're moving the text left by 245px using padding, which is a very "thrown together" method of accomplishing what you want. I'd start by changing the 245px to 0px and add a text-align: right; and moving forward from there.
Change <ol> to <ul> and add this style
ul li{list-style:none}

How to make a header ribbon responsive

I have the following JSFiddle: http://jsfiddle.net/eotamvwy/
HTML:
<div class="infobox-container">
<div class="triangle-l"></div>
<div class="triangle-r"></div>
<div class="infobox">
<h3><span>This is the Header</span></h3>
<p>This is the content of the infobox.<p/>
</div>
</div>
How can I modify the CSS so that it is responsive?
I have a div which has the following style:
width: 98%
padding: 0 1% 0 1%
I want to insert the infobox-container inside and stretch it 100% and resize based on the above div.
Use percentage units for responsiveness and for triangles you don't need extra elements, you could use :after and :before :pseudo-elements on .infobox h3.
Updated Fiddle
body {
width: 100%;
margin: 0;
}
.main-container {
width: 98%;
padding: 0 1% 0 1%;
text-align: center;
}
.infobox-container {
position: relative;
display: inline-block;
margin: 0;
padding: 0;
width: 100%;
}
.infobox {
width: 80%;
padding: 10px 5px 5px 5px;
margin: 10px;
position: relative;
z-index: 1;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.55);
-moz-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.55);
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.55);
background: #424242;
background-image: -webkit-gradient(linear, left top, left bottom, from(#6a6b6b), to(#424242));
background-image: -moz-linear-gradient(top, #6a6a6a, #424242);
color: #fff;
font-size: 90%;
}
.infobox h3 {
position: relative;
width: calc(100% + 22px);
color: #fff;
padding: 10px 5px;
margin: 0;
left: -15px;
-webkit-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.55);
-moz-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.55);
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.55);
background: #3198dd;
background-image: -webkit-gradient(linear, left top, left bottom, from(#33acfc), to(#3198dd));
background-image: -moz-linear-gradient(top, #33acfc, #3198dd);
font-size: 160%;
text-align: center;
text-shadow: #2187c8 0 -1px 1px;
font-weight: bold;
}
.infobox h3:before,
.infobox h3:after {
content: '';
border-color: transparent #2083c2 transparent transparent;
border-style: solid;
border-width: 12px;
height: 0;
width: 0;
position: absolute;
left: -12px;
top: 100%;
transform: translateY(-50%);
z-index: -1;
/* displayed under infobox */
}
.infobox h3:after {
border-color: transparent transparent transparent #2083c2;
left: 100%;
margin-left: -12px;
}
.infobox a {
color: #35b0ff;
text-decoration: none;
border-bottom: 1px dotted transparent;
}
.infobox a:hover,
.infobox a:focus {
text-decoration: none;
border-bottom: 1px dotted #35b0ff;
}
<div class="main-container">
<div class="infobox-container">
<div class="infobox">
<h3><span>This is the Header</span></h3>
<p>This is the content of the infobox.</p>
</div>
</div>
</div>
If you want this header ribbon to be responsive, you need to get away from using fixed-widths and instead combine width:100%; and max-width: 270px; (or whatever).
When you define the width attribute to be 270px, you are telling the browser you want this particular element to have both a minimum and maximum width of 270px. If you are thinking responsively, what you actually want is for your element to expand as much as possible (width:100%), but to max-out at 270px (max-width: 270px;).
Thats the responsive bit.
What you are actually after is something closer to this:
http://jsfiddle.net/TheIronDeveloper/eotamvwy/3/
* {
box-sizing: border-box;
}
.infobox-container {
position: relative;
display: block;
margin: 0;
padding: 0;
max-width: 500px;
width: 100%;
}
.infobox {
padding: 3em 5px 5px;
margin:10px;
position: relative;
z-index: 90;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
-moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
background: #424242;
background-image: -webkit-gradient(linear, left top, left bottom, from(#6a6b6b), to(#424242));
background-image: -moz-linear-gradient(top,#6a6a6a,#424242);
color: #fff;
font-size: 90%;
}
.infobox-ribbon {
position: absolute;
top: 10px;
width: 100%;
color: #fff;
padding: 10px 5px;
margin: 0;
z-index: 100;
-webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
-moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
background: #3198dd;
background-image: -webkit-gradient(linear, left top, left bottom, from(#33acfc), to(#3198dd));
background-image: -moz-linear-gradient(top,#33acfc,#3198dd);
font-size: 160%;
text-align: center;
text-shadow: #2187c8 0 -1px 1px;
font-weight: bold;
}
.infobox-container .triangle-l {
border-color: transparent #2083c2 transparent transparent;
border-style:solid;
border-width:13px;
height:0;
width:0;
position: absolute;
left: -12px;
top: 45px;
z-index: 0; /* displayed under infobox */
}
.infobox-container .triangle-r {
border-color: transparent transparent transparent #2083c2;
border-style:solid;
border-width:13px;
height:0;
width:0;
position: absolute;
right: -12px;
top: 45px;
z-index: 0; /* displayed under infobox */
}
.infobox a {
color: #35b0ff;
text-decoration: none;
border-bottom: 1px dotted transparent;
}
.infobox a:hover, .infobox a:focus {
text-decoration: none;
border-bottom: 1px dotted #35b0ff;
}
<div class="infobox-container">
<div class="triangle-l"></div>
<div class="triangle-r"></div>
<h3 class="infobox-ribbon">This is the Header</h3>
<div class="infobox">
<p>This is the content of the infobox.</p>
</div>
</div>
I did a few things here:
I applied * {box-sizing:border-box;}, which does a nicer job at making elements "mold" to the widths that I tell them to (regardless of margins), more details here
I took the h3 ribbon out of the infobox, and changed its position to absolute. My reasoning is that the h3-ribbon needs to conform to the info-box container's width, not the infobox itself. That way, regardless of the width, the ribbon will conform to its parent, and the infobox can occupy its 100% + margins (which should always be even on both sides.)
And like I mentioned before, I changed the fixed-width of the infobox-container to width:100%;max-width:500px;. If you try resizing down, the ribbon stays in place.
I think you can just make a couple of small changes to make all the sizes responsive at least to the content:
The most important changes:
Use 'Calc' to set the width. Support is reasonable well (see caniuse), but you could also solve this differently using negative margins (or probably other ways as well).
.infobox h3 {
width: calc(100% + 20px);
}
The right arrow can simply be solved by setting right to -12px, just as the left one has left: -12px.
.infobox-container .triangle-r {
right: -12px;
}
.infobox-container {
position: relative;
display: inline-block;
margin: 0;
padding: 0;
width: auto;
}
.infobox {
padding: 10px 5px 5px 5px;
margin:10px;
position: relative;
z-index: 90;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
-moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
background: #424242;
background-image: -webkit-gradient(linear, left top, left bottom, from(#6a6b6b), to(#424242));
background-image: -moz-linear-gradient(top,#6a6a6a,#424242);
color: #fff;
font-size: 90%;
}
.infobox h3 {
position: relative;
width: calc(100% + 20px);
color: #fff;
padding: 10px 5px;
margin: 0;
left: -15px;
z-index: 100;
-webkit-box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
-moz-box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
box-shadow: 0px 0px 3px rgba(0,0,0,0.55);
background: #3198dd;
background-image: -webkit-gradient(linear, left top, left bottom, from(#33acfc), to(#3198dd));
background-image: -moz-linear-gradient(top,#33acfc,#3198dd);
font-size: 160%;
text-align: center;
text-shadow: #2187c8 0 -1px 1px;
font-weight: bold;
}
.infobox-container .triangle-l {
border-color: transparent #2083c2 transparent transparent;
border-style:solid;
border-width:13px;
height:0;
width:0;
position: absolute;
left: -13px;
top: 54px;
z-index: 2; /* displayed under infobox */
}
.infobox-container .triangle-r {
border-color: transparent transparent transparent #2083c2;
border-style:solid;
border-width:13px;
height:0;
width:0;
position: absolute;
right: -12px;
top: 54px;
z-index: 2; /* displayed under infobox */
}
.infobox a {
color: #35b0ff;
text-decoration: none;
border-bottom: 1px dotted transparent;
}
.infobox a:hover, .infobox a:focus {
text-decoration: none;
border-bottom: 1px dotted #35b0ff;
}
<div class="infobox-container">
<div class="triangle-l"></div>
<div class="triangle-r"></div>
<div class="infobox">
<h3><span>This is the Headewefewfewfewfewfewfewfr</span></h3>
<p>This is the content of the infobox.</p>
</div>
</div>

Fixed div over absolute?

I want to create similiar page to this. Especially I am interesed in that image with a flag. I tried to make something similiar to that and this is what I already managed to do: Fiddle.
Html:
<div id="logo"> <img src="http://s20.postimg.org/9sr84gnw9/logo.png" alt="logo"></img>
<ul id="navbar">
<li>Maršrutai
</li>
<li>Nuotraukos
</li>
<li>Apie mane
</li>
<li>Dviračiai
</li>
<li>Kontaktai
</li>
</ul>
<div id="header">
<h1>MARŠRUTAI</h1>
</div>
<div id="content"></div>
CSS:
body {
background: radial-gradient(black 15%, transparent 16%) 0 0, radial-gradient(black 15%, transparent 16%) 8px 8px, radial-gradient(rgba(255, 255, 255, .1) 15%, transparent 20%) 0 1px, radial-gradient(rgba(255, 255, 255, .1) 15%, transparent 20%) 8px 9px;
background-color: #282828;
background-size: 16px 16px;
}
#header {
background-image:url(http://s20.postimg.org/gcpvgfth8/header.jpg);
position: fixed;
width: 100%;
height:150px;
text-align:center;
text-top:50%;
color: white;
top:70px;
left:0;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
padding: 50px 0;
}
#content {
width:100%;
height:100%;
position: absolute;
top:351px;
/*bacground gradients: http://lea.verou.me/css3patterns/# */
background: radial-gradient(black 15%, transparent 16%) 0 0, radial-gradient(black 15%, transparent 16%) 8px 8px, radial-gradient(rgba(255, 255, 255, .1) 15%, transparent 20%) 0 1px, radial-gradient(rgba(255, 255, 255, .1) 15%, transparent 20%) 8px 9px;
background-color: #282828;
background-size: 16px 16px;
left:0;
bottom:0;
}
#logo {
position:fixed;
}
ul {
text-shadow: 0px 2px #444;
font-size: 20px;
padding: 0;
list-style: none;
text-align: center;
display: table;
margin: 0 auto;
position: fixed;
left: 32%;
right: 25%;
top:15px;
}
ul li {
position: relative;
margin: 0;
padding: 0;
display: inline-block;
}
li ul {
display: none;
}
ul li a {
display: inline-block;
text-decoration: none;
color: #eee;
padding: 5px 0;
white-space: nowrap;
margin: 5px;
vertical-align: middle;
text-align: center;
border: 1px solid transparent;
}
ul li a:hover {
border-width: 1px;
border-style: solid;
border-color: #FFFFFF;
-moz-border-radius: 5px;
border-radius: 5px;
color: #CACACA;
As you can see, when you scrool down, content div with pisition:absolute, covers all other divs with position:fixed. But I want that when you scrool down, content div would cover just header div and logo and ul would stay on top of everything. Just like in this page.
I'm not sure that I'm doing it right because I'm newbie at creating html. Is there any other way to make something like that?
Just use an higher z-index on your logo and nav and it will work as you wish.

making ribbon center using css

Im creating a ribbon using css. the page it is on is FOUND HERE
I know the rest of my page needs more work but right this second I am focusing on the ribbon.
I need it to be auto 90% and center no matter what the screen size. at the moment it is cut off on the left a little and not center.
my css code:
.ribbon {
width: 90%;
position: absolute;
text-align: center;
font-size: 15px!important;
background: #2cdb1c;
background: -webkit-gradient(linear, left top, left bottom, from(#2cdb1c), to(#618028));
background: -webkit-linear-gradient(top, #2cdb1c, #618028);
background: -moz-linear-gradient(top, #2cdb1c, #618028);
background: -ms-linear-gradient(top, #2cdb1c, #618028);
background: -o-linear-gradient(top, #2cdb1c, #618028);
background-image: -ms-linear-gradient(top, #2cdb1c 0%, #618028 100%);
-webkit-box-shadow: rgba(000,000,000,0.3) 0 1px 1px;
-moz-box-shadow: rgba(000,000,000,0.3) 0 1px 1px;
box-shadow: rgba(000,000,000,0.3) 0 1px 1px;
font-family: 'Helvetica Neue',Helvetica, sans-serif;
}
.ribbon h1 {
font-size: 23px!important;
color: #000000;
text-shadow: #b9c9b5 0 1px 0;
margin:0px;
padding: 15px 10px;
}
.ribbon:before, .ribbon:after {
content: '';
position: absolute;
display: block;
bottom: -1em;
border: 1.5em solid #379c27;
z-index: -1;
}
.ribbon:before {
left: -2em;
border-right-width: 1.5em;
border-left-color: transparent;
-webkit-box-shadow: rgba(000,000,000,0.4) 1px 1px 1px;
-moz-box-shadow: rgba(000,000,000,0.4) 1px 1px 1px;
box-shadow: rgba(000,000,000,0.4) 1px 1px 1px;
}
.ribbon:after {
right: -2em;
border-left-width: 1.5em;
border-right-color: transparent;
-webkit-box-shadow: rgba(000,000,000,0.4) -1px 1px 1px;
-moz-box-shadow: rgba(000,000,000,0.4) -1px 1px 1px;
box-shadow: rgba(000,000,000,0.4) -1px 1px 1px;
}
.ribbon .ribbon-content:before, .ribbon .ribbon-content:after {
border-color: #000000 transparent transparent transparent;
position: absolute;
display: block;
border-style: solid;
bottom: -1em;
content: '';
}
.ribbon .ribbon-content:before {
left: 0;
border-width: 1em 0 0 1em;
}
.ribbon .ribbon-content:after {
right: 0;
border-width: 1em 1em 0 0;
}
.ribbon-stitches-top {
margin-top:2px;
border-top: 1px dashed rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5);
box-shadow: 0px 0px 2px rgba(255, 255, 255, 0.5);
}
.ribbon-stitches-bottom {
margin-bottom:2px;
border-top: 1px dashed rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 2px rgba(255, 255, 255, 0.3);
}
Can someone please help me? thank you.
It can't be positioned as absolute. Remove that. Make sure its parent has 100% width and then set margin:0 auto;
You could put your entire ribbon inside a divide. Then instead of centering the ribbon just give it a width of 100%.
ribbon_divide {
margin: 0 auto;
width: 90%;
}
You should wrap ribbon element and set width=100% for ribbon.
.ribbon-wrapper {
position: relative;
width: 90%;
margin: 0 auto;
}
.ribbon {
width: 100%
}
<div class="ribbon-wrapper">
<!-- Your ribbon html code -->
</div>
Just wrap your ribbon with a div.
<div style="width:90%;margin:0 auto;">
<div class="ribbon"><div class="ribbon-stitches-top"></div><strong class="ribbon-content"><h1>Xclo.mobi</h1></strong><div class="ribbon-stitches-bottom"></div></div>
</div>
You could actually center it based on percentage and absolutely:
.ribbon {
position: absolute;
width: 90%;
left: 50%;
margin-left: -45%;
}