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}
Related
I'm having trouble with a search box that has a dropdown. In the dropdown there are links but to open the links I have to double click them. Here is a link to my jsfiddle of it https://jsfiddle.net/ag7L02u0/. Anyone have a solution?
HTML:
<form class="search" method="post" action="" >
<input type="text" name="inputSearch" id="inputSearch" placeholder="Search Username" autocomplete="off" />
<ul class="search-ac" id="user-result">
<li>Search Result #2<br /><span>Description...</span></li>
<li>Search Result #3<br /><span>Description...</span></li>
<li>Search Result #4</li>
</ul>
<input type="submit" name="search" id="search" Style="display:none;">
</form>
CSS:
.search {
position: relative;
width: 300px;
float: right;
margin-top:5px;
}
.search input {
height: 26px;
width: 100%;
padding: 5px 12px 0px 25px;
background: white url("../img/search.png") 8px 6px no-repeat;
border: 1px solid;
border-color: #a8acbc #babdcc #c0c3d2;
-webkit-appearance: textfield;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-box-shadow: inset 0 1px #e5e7ed, 0 1px #fcfcfc;
box-shadow: inset 0 1px #e5e7ed, 0 1px #fcfcfc;
}
.search input:focus {
outline: 0;
border-color: #66b1ee;
-webkit-box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
}
.search input:focus + .search-ac {
display: block;
}
.search-ac {
display: none;
position: absolute;
top: 35px;
left: 0;
right: 0;
z-index: 100;
background: #fdfdfd;
border: 1px solid;
border-color: #cbcfe2 #c8cee7 #c4c7d7;
border-radius: 3px;
background-image: -webkit-linear-gradient(top, #fdfdfd, #eceef4);
background-image: -moz-linear-gradient(top, #fdfdfd, #eceef4);
background-image: -o-linear-gradient(top, #fdfdfd, #eceef4);
background-image: linear-gradient(to bottom, #fdfdfd, #eceef4);
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-padding-start: 0px;
}
.search-ac:hover {
display: block;
}
.search-ac li {
display: block;
z-index: 100000;
}
.search-ac li:first-child {
margin-top: -1px;
}
.search-ac li:first-child:before, .search-ac li:first-child:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 50%;
margin-left: -5px;
border: 5px outset transparent;
}
.search-ac li:first-child:before {
border-bottom: 5px solid #c4c7d7;
top: -11px;
}
.search-ac li:first-child:after {
border-bottom: 5px solid #fdfdfd;
top: -10px;
}
.search-ac li:first-child:hover:before, .search-ac li:first-child:hover:after {
display: none;
}
.search-ac li:last-child {
margin-bottom: -1px;
}
.search-ac a {
display: block;
position: relative;
margin: 0 -1px;
padding: 6px 40px 6px 10px;
color: #808394;
font-weight: 500;
text-decoration: none;
text-shadow: 0 1px white;
border: 1px solid transparent;
border-radius: 3px;
z-index:110;
}
.search-ac a span {
font-weight: 200;
}
.search-ac a:before {
content: '';
position: absolute;
top: 50%;
right: 10px;
margin-top: -9px;
width: 18px;
height: 18px;
background: url("../img/arrow.png") 0 0 no-repeat;
}
.search-ac a:hover {
color: white;
text-shadow: 0 -1px rgba(0, 0, 0, 0.3);
background: #338cdf;
border-color: #2380dd #2179d5 #1a60aa;
background-image: -webkit-linear-gradient(top, #59aaf4, #338cdf);
background-image: -moz-linear-gradient(top, #59aaf4, #338cdf);
background-image: -o-linear-gradient(top, #59aaf4, #338cdf);
background-image: linear-gradient(to bottom, #59aaf4, #338cdf);
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 1px rgba(0, 0, 0, 0.08);
box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 1px rgba(0, 0, 0, 0.08);
}
:-moz-placeholder {
color: #a7aabc;
font-weight: 200;
}
::-webkit-input-placeholder {
color: #a7aabc;
font-weight: 200;
line-height: 14px;
}
::-webkit-search-decoration,
::-webkit-search-cancel-button {
-webkit-appearance: none;
}
.lt-ie9 .search input {
line-height: 26px;
}
.btn-default{
float:right;
margin-top: -38px;
}
Have you tried changing your href attribute to something else than "#"?
I tried tour example and put there
<a href="http://stackoverflow.com" target="_">
works fine
Works for me? I just added www.google.com in the href and target="_blank" (so i didn't navigate away) and it re-directs. What are you doing with the links in your real document please.
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>
I am building a departmental website and am running into a unique issue with my dock panel resizing incorrectly, but only with Chrome.
When I change the information inside the center of my dock panel to be something taller it expands correctly, but never resizes back down to fit shorter material. It works perfectly in firefox, IE and Spartan, but not in Chrome. It appears that it is setting the bottom-padding for the center instead of resizing the element.
Here's a link to 3 images on imgur that show the differences.
View post on imgur.com
Here's my code for creating the center container:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style>
</ui:style>
<g:HTMLPanel>
<g:DockPanel styleName="my-DockPanel">
<g:Dock direction="NORTH">
<g:HorizontalPanel width="750px" styleName="page-header">
<g:cell horizontalAlignment="ALIGN_LEFT">
<g:HTML>
</g:HTML>
</g:cell>
<g:cell horizontalAlignment="ALIGN_CENTER">
<g:Image url="Resources/Images/CSDepartment_Banner.gif" />
</g:cell>
</g:HorizontalPanel>
</g:Dock>
<g:Dock direction="SOUTH">
<g:HorizontalPanel styleName="page-footer">
<g:HTML>
</g:HTML>
<g:HTML>
<DIV align="center">
The Department of Computer Science
<br />
<br />
<br />
<br />
<br />
Last modified: July 1, 2015
<br />
<br />
</DIV>
</g:HTML>
<g:cell horizontalAlignment="ALIGN_RIGHT">
<g:HTML>
</g:HTML>
</g:cell>
</g:HorizontalPanel>
</g:Dock>
<g:Dock direction="EAST">
<g:VerticalPanel width="100%" height="100%">
</g:VerticalPanel>
</g:Dock>
<g:Dock direction="WEST">
<g:VerticalPanel width="100%" height="100%">
<g:Label>
</g:Label>
</g:VerticalPanel>
</g:Dock>
<g:Dock direction="NORTH">
<g:HorizontalPanel width="100%">
<g:cell horizontalAlignment="ALIGN_CENTER">
<g:MenuBar ui:field="navigationBar"></g:MenuBar>
</g:cell>
</g:HorizontalPanel>
</g:Dock>
<g:Dock direction="CENTER" width="1260px" height="100%">
<g:ScrollPanel height="auto">
<g:DeckPanel ui:field="deckPanel" height="100%">
</g:DeckPanel>
</g:ScrollPanel>
</g:Dock>
</g:DockPanel>
</g:HTMLPanel>
</ui:UiBinder>
And here's the CSS for the entire page:
#CHARSET "ISO-8859-1";
/**
* This file is linked through the index.html file
*/
body {
/*background-color: #CCCCCC !important;*/
background-color: #fff5ec;
font-family: "Garamond Premier Pro", "Myriad Pro", "Verdana",
"Times New Roman";
}
/*Adds a drop shadow at the top of the page and stays there.*/
body:before {
content: "";
position: fixed;
top: -10px;
left: 0;
width: 100%;
height: 10px;
-webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, .8);
-moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, .8);
box-shadow: 0px 0px 10px rgba(0, 0, 0, .8);
z-index: 100;
}
.my-dockPanel {
margin: 0;
padding: 0;
}
.my-dockPanel {
margin: 0px;
padding: 0px;
}
.my-DockPanel td {
padding: 0px;
margin: 0px;
}
.my-DockPanel {
height: 100%;
width: 100%;
border-spacing: 0px;
font-color: white;
}
.page-footer {
height: auto;
width: 1260px;
background-color: #003366;
padding: 0px;
margin: auto;
color: #FFF;
}
.page-header {
height: 100px;
/* display: block; */
margin-left: auto;
margin-right: auto;
}
.blog-title {
font-weight: bold;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
background: #555555;
}
.blog-panel {
border-top: 1px solid black;
padding: 2px;
margin-bottom: 6px;
}
.my-ScrollPane {
width: auto;
padding: 0px 0px 0px 0px;
min-height: 641px;
}
.gwt-MenuBar {
cursor: default;
}
.gwt-MenuBar .gwt-MenuItem {
cursor: default;
}
.gwt-MenuBar .gwt-MenuItem-selected {
/* background: #666; */
background: #335685;
color: #0cf;
}
.gwt-MenuBar-horizontal {
/* background: #222222; */
background: #003366;
border-radius: 55px 55px 0px 0px;
-moz-border-radius: 55px 55px 0px 0px;
-webkit-border-radius: 55px 55px 0px 0px;
border: 1px solid #000000;
}
.gwt-MenuBar-horizontal .gwt-MenuItem {
padding: 0px 10px;
vertical-align: bottom;
font-weight: bold;
color: #E0E0E0;
border-radius: 15px 15px 15px 15px;
-moz-border-radius: 15px 15px 15px 15px;
-webkit-border-radius: 15px 15px 15px 15px;
border-left: 2px solid #000000;
border-right: 2px solid #000000;
}
.gwt-MenuBar-horizontal .gwt-MenuItemSeparator {
width: 1px;
padding: 0px;
margin: 0px;
border: 0px;
border-left: 1px solid #bec7cc;
background: #000;
}
.gwt-MenuBar-horizontal .gwt-MenuItemSeparator .menuSeparatorInner {
width: 1px;
height: 1px;
background: #000;
}
.gwt-MenuBar-vertical {
margin-top: -5px;
margin-left: 0px;
padding-left: 2px;
/* background: #4D4D4D; */ /*background: #194775;*/
background: #003366;
color: #E0E0E0;
-webkit-box-shadow: 10px 10px 5px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 10px 10px 5px 0px rgba(0, 0, 0, 0.75);
box-shadow: 10px 10px 5px 0px rgba(0, 0, 0, 0.75);
border-left: 1px solid #000000;
border-right: 1px solid #000000;
border-bottom: 1px solid #000000;
opacity: 0.9;
}
.gwt-MenuBar-vertical table {
border-collapse: collapse;
}
.gwt-MenuBar-vertical .gwt-MenuItem {
padding: 4px 14px 4px 1px;
}
.gwt-MenuBar-vertical .gwt-MenuItemSeparator {
padding: 2px 0px;
}
.gwt-MenuBar-vertical .gwt-MenuItemSeparator .menuSeparatorInner {
height: 1px;
padding: 0px;
border: 0px;
border-top: 1px solid #bec7cc;
background: #222;
overflow: hidden;
}
.gwt-MenuBar-vertical .subMenuIcon {
padding-right: 4px;
}
.gwt-MenuBar-vertical .subMenuIcon-selected {
/* background: #666; */
background: #335685;
}
.gwt-MenuBarPopup {
margin: 0px 0px 0px 3px;
}
.gwt-MenuBarPopup .menuPopupTopCenter {
background: url(images/hborder.png) 0px -12px repeat-x;
}
.gwt-MenuBarPopup .menuPopupBottomCenter {
background: url(images/hborder.png) 0px -13px repeat-x;
-background: url(images/hborder_ie6.png) 0px -13px repeat-x;
}
.gwt-MenuBarPopup .menuPopupMiddleLeft {
background: url(images/vborder.png) -12px 0px repeat-y;
-background: url(images/vborder_ie6.png) -12px 0px repeat-y;
}
.gwt-MenuBarPopup .menuPopupMiddleRight {
background: url(images/vborder.png) -13px 0px repeat-y;
-background: url(images/vborder_ie6.png) -13px 0px repeat-y;
}
.gwt-MenuBarPopup .menuPopupTopLeftInner {
width: 5px;
height: 5px;
zoom: 1;
}
.gwt-MenuBarPopup .menuPopupTopRightInner {
width: 8px;
height: 5px;
zoom: 1;
}
.gwt-MenuBarPopup .menuPopupBottomLeftInner {
width: 5px;
height: 8px;
zoom: 1;
}
.gwt-MenuBarPopup .menuPopupBottomRightInner {
width: 8px;
height: 8px;
zoom: 1;
}
.gwt-MenuBarPopup .menuPopupTopLeft {
background: url(images/corner.png) no-repeat 0px -36px;
-background: url(images/corner_ie6.png) no-repeat 0px -36px;
}
.gwt-MenuBarPopup .menuPopupTopRight {
background: url(images/corner.png) no-repeat -5px -36px;
-background: url(images/corner_ie6.png) no-repeat -5px -36px;
}
.gwt-MenuBarPopup .menuPopupBottomLeft {
background: url(images/corner.png) no-repeat 0px -41px;
-background: url(images/corner_ie6.png) no-repeat 0px -41px;
}
.gwt-MenuBarPopup .menuPopupBottomRight {
background: url(images/corner.png) no-repeat -5px -41px;
-background: url(images/corner_ie6.png) no-repeat -5px -41px;
}
* html .gwt-MenuBarPopup .menuPopupTopLeftInner {
width: 5px;
height: 5px;
overflow: hidden;
}
* html .gwt-MenuBarPopup .menuPopupTopRightInner {
width: 8px;
height: 5px;
overflow: hidden;
}
* html .gwt-MenuBarPopup .menuPopupBottomLeftInner {
width: 5px;
height: 8px;
overflow: hidden;
}
* html .gwt-MenuBarPopup .menuPopupBottomRightInner {
width: 8px;
height: 8px;
overflow: hidden;
}
.blog_image {
padding: 1px;
margin: 0px 20px 0px 20px;
border: 0px solid #021a40;
/* width:300px; */
/* height:auto; */
}
.staff-image {
padding: 1px;
margin: 0px 20px 0px 0px;
border: 0px solid #021a40;
width: auto;
height: 200px;
}
.staff-information {
width: 1260px;
height: 230px;
/* border: 20px solid #021a40; */ /* margin: 0px 0px 25px 0px; */
border-radius: 9px 9px 9px 9px;
-moz-border-radius: 9px 9px 9px 9px;
-webkit-border-radius: 9px 9px 9px 9px;
border-top: 2px solid #000000;
border-left: 2px dashed #000000;
border-right: 2px dashed #000000;
}
.staff-information-west {
/* background-color: #000000; */
font-weight: bold;
margin-left: auto;
margin-right: auto;
width: 315px;
}
.staff-information-east {
margin-left: auto;
margin-right: auto;
width: 315px;
horizontal-align: left;
}
.featured-item-1 {
border-left: 3px solid #003366;
border-top: 3px solid #003366;
}
.featured-item-2 {
border-left: 3px solid #003366;
border-right: 3px solid #003366;
border-top: 3px solid #003366;
}
.featured-item-3 {
border-right: 3px solid #003366;
border-top: 3px solid #003366;
}
.featured-title {
width: 406px;
text-transform: uppercase;
padding-left: 10px;
}
.featured_image {
/* padding-left: 10px; */ /* margin: 0px 0px 0px 10px; */
width: 130px;
height: 130px;
-webkit-box-shadow: 10px 10px 20px 1px rgba(0, 51, 102, 1);
-moz-box-shadow: 10px 10px 20px 1px rgba(0, 51, 102, 1);
box-shadow: 10px 10px 20px 1px rgba(0, 51, 102, 1);
}
.featured-body {
width: 216px;
height: auto;
font-size: 15px;
padding-left: 15px;
}
.myButton {
-moz-box-shadow: inset 0px 1px 0px 0px #7a8eb9;
-webkit-box-shadow: inset 0px 1px 0px 0px #7a8eb9;
box-shadow: inset 0px 1px 0px 0px #7a8eb9;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #637aad
), color-stop(1, #5972a7));
background: -moz-linear-gradient(top, #637aad 5%, #5972a7 100%);
background: -webkit-linear-gradient(top, #637aad 5%, #5972a7 100%);
background: -o-linear-gradient(top, #637aad 5%, #5972a7 100%);
background: -ms-linear-gradient(top, #637aad 5%, #5972a7 100%);
background: linear-gradient(to bottom, #637aad 5%, #5972a7 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#637aad',
endColorstr='#5972a7', GradientType=0);
background-color: #637aad;
border: 1px solid #314179;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: Arial;
font-size: 28px;
font-weight: bold;
padding: 32px 76px;
text-decoration: none;
}
.myButton:hover {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #5972a7
), color-stop(1, #637aad));
background: -moz-linear-gradient(top, #5972a7 5%, #637aad 100%);
background: -webkit-linear-gradient(top, #5972a7 5%, #637aad 100%);
background: -o-linear-gradient(top, #5972a7 5%, #637aad 100%);
background: -ms-linear-gradient(top, #5972a7 5%, #637aad 100%);
background: linear-gradient(to bottom, #5972a7 5%, #637aad 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5972a7',
endColorstr='#637aad', GradientType=0);
background-color: #5972a7;
}
.myButton:active {
position: relative;
top: 1px;
}
.html-clicked {
background: url("Resources/Images/Widgets/things.png") repeat scroll 0 0
transparent;
height: 68px;
list-style: none outside none;
margin: 0;
line-height: 63px;
padding-left: 25px;
color: #fff;
font-family: georgia;
font-weight: bold;
font-size: 13px;
cursor: pointer;
}
.html-unclicked {
background: url("Resources/Images/Widgets/things.png") repeat scroll 0
-66px transparent;
height: 68px;
list-style: none outside none;
margin: 0;
line-height: 63px;
padding-left: 25px;
color: #23438a;
font-family: georgia;
font-weight: bold;
font-size: 13px;
cursor: pointer;
}
This is the last major issue holding me back from pushing this to production (besides making new images). I've been chasing my tail on this one for 3 days now, and am finally giving up.
Ok, I got it working, but it caused another issue that I had to fix. The entire problem above had to do with my CSS for .my-DockPanel
Before:
.my-DockPanel {
height: 100%;
width: 100%;
border-spacing: 0px;
font-color: white;
}
After:
.my-DockPanel {
height: auto;
width: 100%;
border-spacing: 0px;
font-color: white;
}
This created a new issue with certain pages sliding to the left, but all I had to do was set their width to be static. Problem solved!
I'm using this:
jsfiddle.net/wromLbq5
And am hoping to have the ability to have multiple accordion sections open at once, and on page load. By this I mean, when one opens, I don't want the other to close. Is this possible? Without javascript as well.
(Ignore all the sub accordions too- I only need one layer)
HTML
<ul class="accordion">
<li id="one" class="files">
My Files<span>495</span>
<ul class="sub-menu">
<li><em>01</em>Dropbox<span>42</span></li>
<li><em>02</em>Skydrive<span>87</span></li>
<li><em>03</em>FTP Server<span>366</span></li>
<li><em>01</em>Dropbox<span>42</span></li>
<li><em>01</em>Dropbox<span>42</span></li>
</ul>
</li>
<li id="two" class="mail">
Mail<span>26</span>
<ul class="sub-menu">
<li><em>01</em>Hotmail<span>9</span></li>
<li><em>02</em>Yahoo<span>14</span></li>
<li><em>03</em>Gmail<span>3</span></li>
</ul>
</li>
<li id="three" class="cloud">
Cloud<span>58</span>
<ul class="sub-menu">
<li><em>01</em>Connect<span>12</span></li>
<li><em>02</em>Profiles<span>19</span></li>
<li><em>03</em>Options<span>27</span></li>
</ul>
</li>
<li id="four" class="sign">
Sign Out
<ul class="sub-menu">
<li><em>01</em>Log Out</li>
<li><em>02</em>Delete Account</li>
<li><em>03</em>Freeze Account</li>
</ul>
</li>
</ul>
CSS
body {margin:50px;}
/* Reset */
.accordion,
.accordion ul,
.accordion li,
.accordion a,
.accordion span {
margin: 0;
padding: 0;
border: none;
outline: none;
}
.accordion li {
list-style: none;
}
/* Layout & Style */
.accordion li > a {
display: block;
position: relative;
min-width: 110px;
padding: 0 10px 0 40px;
height: 32px;
color: #fdfdfd;
font: bold 12px/32px Arial, sans-serif;
text-decoration: none;
text-shadow: 0px 1px 0px rgba(0,0,0, .35);
background: #6c6e74;
background: -moz-linear-gradient(top, #6c6e74 0%, #4b4d51 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6c6e74), color-stop(100%,#4b4d51));
background: -webkit-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: -o-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: -ms-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
-webkit-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
-moz-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
}
.accordion > li:hover > a,
.accordion > li:target > a {
color: #3e5706;
text-shadow: 1px 1px 1px rgba(255,255,255, .2);
/*background: url(../img/active.png) repeat-x;*/
background: #a5cd4e;
background: -moz-linear-gradient(top, #a5cd4e 0%, #6b8f1a 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a5cd4e), color-stop(100%,#6b8f1a));
background: -webkit-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: -o-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: -ms-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
}
.accordion li > a span {
display: block;
position: absolute;
top: 7px;
right: 0;
padding: 0 10px;
margin-right: 10px;
font: normal bold 12px/18px Arial, sans-serif;
background: #404247;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
-webkit-box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
-moz-box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
}
.accordion > li:hover > a span,
.accordion > li:target > a span {
color: #fdfdfd;
text-shadow: 0px 1px 0px rgba(0,0,0, .35);
background: #3e5706;
}
/* Images */
.accordion > li > a:before {
position: absolute;
top: 0;
left: 0;
content: '';
width: 24px;
height: 24px;
margin: 4px 8px;
background-repeat: no-repeat;
background-image: url(http://designmodo.com/demo/css3accordionmenu/img/icons.png);
background-position: 0px 0px;
}
.accordion li.files > a:before { background-position: 0px 0px; }
.accordion li.files:hover > a:before,
.accordion li.files:target > a:before { background-position: 0px -24px; }
.accordion li.mail > a:before { background-position: -24px 0px; }
.accordion li.mail:hover > a:before,
.accordion li.mail:target > a:before { background-position: -24px -24px; }
.accordion li.cloud > a:before { background-position: -48px 0px; }
.accordion li.cloud:hover > a:before,
.accordion li.cloud:target > a:before { background-position: -48px -24px; }
.accordion li.sign > a:before { background-position: -72px 0px; }
.accordion li.sign:hover > a:before,
.accordion li.sign:target > a:before { background-position: -72px -24px; }
/* Sub Menu */
.sub-menu li a {
color: #797979;
text-shadow: 1px 1px 0px rgba(255,255,255, .2);
background: #e5e5e5;
border-bottom: 1px solid #c9c9c9;
-webkit-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
-moz-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
}
.sub-menu li:hover a { background: #efefef; }
.sub-menu li:last-child a { border: none; }
.sub-menu li > a span {
color: #797979;
text-shadow: 1px 1px 0px rgba(255,255,255, .2);
background: transparent;
border: 1px solid #c9c9c9;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.sub-menu em {
position: absolute;
top: 0;
left: 0;
margin-left: 14px;
color: #a6a6a6;
font: normal 10px/32px Arial, sans-serif;
}
/* Functionality */
.accordion li > .sub-menu li {
height: 0;
overflow: hidden;
-webkit-transition: height .2s ease-in-out;
-moz-transition: height .2s ease-in-out;
-o-transition: height .2s ease-in-out;
-ms-transition: height .2s ease-in-out;
transition: height .2s ease-in-out;
}
.accordion li:target > .sub-menu li {
height: 33px;
}
I'm trying to avoid any java script.
Is this possible?
No this is not possible with only css, because your example uses the CSS3 :target selector. When you click on another item the target changes.
You cannot set state with css but you can style it. If you would like to keep each section open after clicking you would have to use javascript, but you don't need jQuery
If you would like to use javascript, this mimics the css as closely as possible while allowing the accordions to stay open. To close the accordion simply click on the title again.
var lists = document.querySelectorAll('.accordion > li > a'); // get list title links
for (var i = 0; i < lists.length; i++) { // for each list title link
lists[i].href = "javascript:void()"; // stop the page from jumping
lists[i].onclick = function(e) { // when you click the link
var items = e.target.parentNode.querySelectorAll('li'); // get all list items that are siblings of the clicked link
for (var x = 0; x < items.length; x++) { // for each list item
if (items[x].style.height != '33px') { // if its not open
items[x].style.height = '33px'; // open it
} else { // otherwise
items[x].style.height = '0px'; // close it
}
}
};
}
Wrap this in a script tag then either drop it in at the bottom of the body, or wrap it in document.onload = function() { /* Script Here */ }
(Demo)
Note while any style with the :target selector will cease to have effect, you should leave them in the css as a fallback in case the user has javascript disabled.
This css is showing all of the accordions as closed using this style:
.accordion li > .sub-menu li {
height: 0px;
}
You could set it to 33px to show all open when the page opens - but that would break the functionality as it is the :target selector which then sets the height and thus causes the selected section to show as open.
The only solution is to move into javascript.....
Can it be done? Yes
Do you need to change your HTML? Yes
Is it pretty? No
Basically instead of Target maintaining state. Use a checkbox replacing you top level a tags with label.
body {margin:50px;}
/* Reset */
.accordion,
.accordion ul,
.accordion li,
.accordion label,
.accordion span {
margin: 0;
padding: 0;
border: none;
outline: none;
}
.accordion li {
list-style: none;
}
.accordion input[type="checkbox"]{display:none;}
/* Layout & Style */
.accordion li > label, .accordion li > a {
display: block;
position: relative;
min-width: 110px;
padding: 0 10px 0 40px;
height: 32px;
color: #fdfdfd;
font: bold 12px/32px Arial, sans-serif;
text-decoration: none;
text-shadow: 0px 1px 0px rgba(0,0,0, .35);
background: #6c6e74;
background: -moz-linear-gradient(top, #6c6e74 0%, #4b4d51 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6c6e74), color-stop(100%,#4b4d51));
background: -webkit-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: -o-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: -ms-linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
background: linear-gradient(top, #6c6e74 0%,#4b4d51 100%);
-webkit-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
-moz-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
}
.accordion > li:hover > label,
.accordion > li:target > label,
.accordion > li > input[type="checkbox"]:checked ~ label{
color: #3e5706;
text-shadow: 1px 1px 1px rgba(255,255,255, .2);
/*background: url(../img/active.png) repeat-x;*/
background: #a5cd4e;
background: -moz-linear-gradient(top, #a5cd4e 0%, #6b8f1a 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a5cd4e), color-stop(100%,#6b8f1a));
background: -webkit-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: -o-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: -ms-linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
background: linear-gradient(top, #a5cd4e 0%,#6b8f1a 100%);
}
.accordion li > label span, .accordion li > a span {
display: block;
position: absolute;
top: 7px;
right: 0;
padding: 0 10px;
margin-right: 10px;
font: normal bold 12px/18px Arial, sans-serif;
background: #404247;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
-webkit-box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
-moz-box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
box-shadow: inset 1px 1px 1px rgba(0,0,0, .2), 1px 1px 1px rgba(255,255,255, .1);
}
.accordion > li:hover > label span,
.accordion > li:target > label span,
.accordion > li > input[type="checkbox"]:checked ~ label span{
color: #fdfdfd;
text-shadow: 0px 1px 0px rgba(0,0,0, .35);
background: #3e5706;
}
/* Images */
.accordion > li > label:before {
position: absolute;
top: 0;
left: 0;
content: '';
width: 24px;
height: 24px;
margin: 4px 8px;
background-repeat: no-repeat;
background-image: url(http://designmodo.com/demo/css3accordionmenu/img/icons.png);
background-position: 0px 0px;
}
.accordion li.files > label:before { background-position: 0px 0px; }
.accordion li.files:hover > labe:before,
.accordion li.files:target > label:before { background-position: 0px -24px; }
.accordion li.mail > label:before { background-position: -24px 0px; }
.accordion li.mail:hover > label:before,
.accordion li.mail:target > label:before { background-position: -24px -24px; }
.accordion li.cloud > label:before { background-position: -48px 0px; }
.accordion li.cloud:hover > label:before,
.accordion input[type="checkbox"]:checked:before { background-position: -48px -24px; }
.accordion li.sign > label:before { background-position: -72px 0px; }
.accordion li.sign:hover > label:before,
.accordion input[type="checkbox"]:checked:before { background-position: -72px -24px; }
/* Sub Menu */
.sub-menu li > a {
color: #797979;
text-shadow: 1px 1px 0px rgba(255,255,255, .2);
background: #e5e5e5;
border-bottom: 1px solid #c9c9c9;
-webkit-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
-moz-box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
box-shadow: inset 0px 1px 0px 0px rgba(255,255,255, .1), 0px 1px 0px 0px rgba(0,0,0, .1);
}
.sub-menu li:hover a { background: #efefef; }
.sub-menu li:last-child a { border: none; }
.sub-menu li > a span {
color: #797979;
text-shadow: 1px 1px 0px rgba(255,255,255, .2);
background: transparent;
border: 1px solid #c9c9c9;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.sub-menu em {
position: absolute;
top: 0;
left: 0;
margin-left: 14px;
color: #a6a6a6;
font: normal 10px/32px Arial, sans-serif;
}
/* Functionality */
.accordion li > .sub-menu li {
height: 0;
overflow: hidden;
-webkit-transition: height .2s ease-in-out;
-moz-transition: height .2s ease-in-out;
-o-transition: height .2s ease-in-out;
-ms-transition: height .2s ease-in-out;
transition: height .2s ease-in-out;
}
.accordion input[type="checkbox"]:checked ~ .sub-menu li {
height: 33px;
}
<ul class="accordion">
<li id="one" class="files">
<input type="checkBox" id="cbOne" checked="checked" /><label for="cbOne" >My Files<span>495</span></label>
<ul class="sub-menu">
<li><em>01</em>Dropbox<span>42</span></li>
<li><em>02</em>Skydrive<span>87</span></li>
<li><em>03</em>FTP Server<span>366</span></li>
<li><em>01</em>Dropbox<span>42</span></li>
<li><em>01</em>Dropbox<span>42</span></li>
</ul>
</li>
<li id="two" class="mail">
<input type="checkBox" id="cbTwo" checked="checked" /><label for="cbTwo" >Mail<span>26</span></label>
<ul class="sub-menu">
<li><em>01</em>Hotmail<span>9</span></li>
<li><em>02</em>Yahoo<span>14</span></li>
<li><em>03</em>Gmail<span>3</span></li>
</ul>
</li>
<li id="three" class="cloud">
<input type="checkBox" id="cbThree" checked="checked" /><label for="cbThree" >Cloud<span>58</span></label>
<ul class="sub-menu">
<li><em>01</em>Connect<span>12</span></li>
<li><em>02</em>Profiles<span>19</span></li>
<li><em>03</em>Options<span>27</span></li>
</ul>
</li>
<li id="four" class="sign">
<input type="checkBox" id="cbFour" checked="checked" /><label for="cbFour" >Sign Out</label>
<ul class="sub-menu">
<li><em>01</em>Log Out</li>
<li><em>02</em>Delete Account</li>
<li><em>03</em>Freeze Account</li>
</ul>
</li>
</ul>
Look Ma! No Javascript!
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>