Hello, I'm learning CSS and was wondering how can I implement the styling above. What kind of effect/style is it called?
I've never implemented something like that before so I don't know where to even start.
I have implemented something. Which is very resembles the design you have shared.
.button {
position: relative;
padding: 20px 25px;
background: #0977d0;
color: #fff;
border: 0;
font-size: 14px;
font-weight: 700;
border-radius: 5px;
overflow: hidden;
cursor: pointer;
}
.button:before {
width: 20px;
height: 20px;
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 0;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
transition: all 0.4s ease-in-out;
opacity: 0;
}
.button span {
position: relative;
z-index: 1;
}
.button:hover::before {
width: 70px;
height: 70px;
opacity: 1;
}
<button class="button"><span>Pressed</span></button>
<button>Click Me!</button>
And Css code
<style type="text/css">
#keyframes gradient {
0% {
background: radial-gradient(circle at center, rgba( 255, 125 , 125, 0 ) 0%, #fff 0%, #fff 100%);
}
25% {
background: radial-gradient(circle at center, rgba( 255, 125, 125, 0.3 ) 24%, #fff 25%, #fff 100%);
}
50% {
background: radial-gradient(circle at center, rgba( 255, 125, 125, 0.5 ) 49%, #fff 50%, #fff 100%);
}
75% {
background: radial-gradient(circle at center, rgba( 255, 125, 125, 0.8 ) 74%, #fff 75%, #fff 100%);
}
100% {
color: #fff;
background: radial-gradient(circle at center, #f88 99%, #fff 100%, #fff 100%);
}
}
body {
background: #68d;
}
button {
margin-left: calc( 50vw - 175px );
margin-top: calc( 50vh - 30px );
width: 350px;
height: 60px;
border: none;
border-radius: 5px;
background: #fff;
font-weight: bold;
font-size: 1.1em;
color: #666;
box-shadow: 0 6px 6px #06f;
outline: none;
}
button:active {
/* set time duration to your needs */
animation: gradient 100ms;
background: #f88;
color: #fff;
box-shadow: none;
}
</style>
Can also be achieved using JS and CSS classes
<div class='button'></div>
CSS
.button {
width: 220px;
height: 70px;
background-color:blue;
overflow: hidden;
position: relative;
cursor: pointer;
transition: 0.3s;
}
.ripple {
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.5);
position: absolute;
transform: scale(0);
animation: ripple 0.6s linear;
pointer-events: none;
}
#keyframes ripple {
to {
transform: scale(3.5);
opacity: 0;
}
}
JS
function buttonClick() {
var buttons = document.querySelectorAll('.button')
Array.prototype.forEach.call(buttons, function(button) {
button.addEventListener('click', createRipple)
})
}
function createRipple(element) {
var circle = document.createElement('div')
this.appendChild(circle)
var dimensions = Math.max(this.clientWidth, this.clientHeight)
circle.style.width = circle.style.height = dimensions + 'px'
circle.style.left = element.clientX - this.offsetLeft - dimensions / 2 + 'px'
circle.style.top = element.clientY - this.offsetTop - dimensions / 2 + 'px'
circle.classList.add('ripple')
circle.addEventListener('animationend', () => {
circle.remove()
})
}
Related
I am trying to edit this free template but im stuck with banner. I need to edit banner so that only image remains and not this red transparent background over it.
Here is the link to the template: http://app-radetic.com/ivanj_t/index.html
and this is css file. I can't find out where in banner section I can change it.
/* Banner */
#banner {
-ms-flex-align: center;
-ms-flex-pack: center;
background-color: #111111;
color: rgba(255, 255, 255, 0.5);
-moz-align-items: center;
-webkit-align-items: center;
-ms-align-items: center;
align-items: center;
display: -moz-flex;
display: -webkit-flex;
display: -ms-flex;
display: flex;
-moz-justify-content: center;
-webkit-justify-content: center;
-ms-justify-content: center;
justify-content: center;
background-image: url("../../images/banner.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
border-top: 0;
display: -ms-flexbox;
height: 35rem !important;
min-height: 35rem;
overflow: hidden;
position: relative;
text-align: center;
width: 100%; }
#banner input, #banner select, #banner textarea {
color: #ffffff; }
#banner a {
color: #ce1b28; }
#banner strong, #banner b {
color: #ffffff; }
#banner h1, #banner h2, #banner h3, #banner h4, #banner h5, #banner h6 {
color: #ffffff; }
#banner blockquote {
border-left-color: rgba(255, 255, 255, 0.25); }
#banner code {
background: rgba(255, 255, 255, 0.075);
border-color: rgba(255, 255, 255, 0.25); }
#banner hr {
border-bottom-color: rgba(255, 255, 255, 0.25); }
#banner input[type="submit"],
#banner input[type="reset"],
#banner input[type="button"],
#banner button,
#banner .button {
background-color: transparent;
box-shadow: inset 0 0 0 1px #ffffff;
color: #ffffff !important; }
#banner input[type="submit"]:hover,
#banner input[type="reset"]:hover,
#banner input[type="button"]:hover,
#banner button:hover,
#banner .button:hover {
/box-shadow: inset 0 0 0 1px #ce1b28;
color: #ce1b28 !important; }
#banner input[type="submit"]:hover:active,
#banner input[type="reset"]:hover:active,
#banner input[type="button"]:hover:active,
#banner button:hover:active,
#banner .button:hover:active {
background-color: rgba(206, 27, 40, 0.25); }
#banner input[type="submit"].primary,
#banner input[type="reset"].primary,
#banner input[type="button"].primary,
#banner button.primary,
#banner .button.primary {
box-shadow: none;
background-color: #ce1b28;
color: #ffffff !important; }
#banner input[type="submit"].primary:hover,
#banner input[type="reset"].primary:hover,
#banner input[type="button"].primary:hover,
#banner button.primary:hover,
#banner .button.primary:hover {
background-color: #e2212f;
box-shadow: none; }
#banner input[type="submit"].primary:hover:active,
#banner input[type="reset"].primary:hover:active,
#banner input[type="button"].primary:hover:active,
#banner button.primary:hover:active,
#banner .button.primary:hover:active {
background-color: #b71824; }
#banner label {
color: #ffffff; }
#banner input[type="text"],
#banner input[type="password"],
#banner input[type="email"],
#banner input[type="tel"],
#banner input[type="search"],
#banner input[type="url"],
#banner select,
#banner textarea {
background-color: rgba(255, 255, 255, 0.075);
border-color: rgba(255, 255, 255, 0.25); }
#banner input[type="text"]:focus,
#banner input[type="password"]:focus,
#banner input[type="email"]:focus,
#banner input[type="tel"]:focus,
#banner input[type="search"]:focus,
#banner input[type="url"]:focus,
#banner select:focus,
#banner textarea:focus {
border-color: #ce1b28;
box-shadow: 0 0 0 1px #ce1b28; }
#banner select {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' preserveAspectRatio='none' viewBox='0 0 40 40'%3E%3Cpath d='M9.4,12.3l10.4,10.4l10.4-10.4c0.2-0.2,0.5-0.4,0.9-0.4c0.3,0,0.6,0.1,0.9,0.4l3.3,3.3c0.2,0.2,0.4,0.5,0.4,0.9 c0,0.4-0.1,0.6-0.4,0.9L20.7,31.9c-0.2,0.2-0.5,0.4-0.9,0.4c-0.3,0-0.6-0.1-0.9-0.4L4.3,17.3c-0.2-0.2-0.4-0.5-0.4-0.9 c0-0.4,0.1-0.6,0.4-0.9l3.3-3.3c0.2-0.2,0.5-0.4,0.9-0.4S9.1,12.1,9.4,12.3z' fill='rgba(255, 255, 255, 1.0)' /%3E%3C/svg%3E"); }
#banner select option {
color: rgba(255, 255, 255, 0.5);
background-color: #111111; }
#banner input[type="checkbox"] + label,
#banner input[type="radio"] + label {
color: rgba(255, 255, 255, 0.5); }
#banner input[type="checkbox"] + label:before,
#banner input[type="radio"] + label:before {
background: rgba(255, 255, 255, 0.075);
border-color: rgba(255, 255, 255, 0.25); }
#banner input[type="checkbox"]:checked + label:before,
#banner input[type="radio"]:checked + label:before {
background-color: #ce1b28;
border-color: #ce1b28;
color: #ffffff; }
#banner input[type="checkbox"]:focus + label:before,
#banner input[type="radio"]:focus + label:before {
border-color: #ce1b28;
box-shadow: 0 0 0 1px #ce1b28; }
#banner ::-webkit-input-placeholder {
color: rgba(255, 255, 255, 0.4) !important; }
#banner :-moz-placeholder {
color: rgba(255, 255, 255, 0.4) !important; }
#banner ::-moz-placeholder {
color: rgba(255, 255, 255, 0.4) !important; }
#banner :-ms-input-placeholder {
color: rgba(255, 255, 255, 0.4) !important; }
#banner ul.alt li {
border-top-color: rgba(255, 255, 255, 0.25); }
#banner table tbody tr {
border-color: rgba(255, 255, 255, 0.25); }
#banner table tbody tr:nth-child(2n + 1) {
background-color: rgba(255, 255, 255, 0.075); }
#banner table th {
color: #ffffff; }
#banner table thead {
border-bottom-color: rgba(255, 255, 255, 0.25); }
#banner table tfoot {
border-top-color: rgba(255, 255, 255, 0.25); }
#banner table.alt tbody tr td {
border-color: rgba(255, 255, 255, 0.25); }
#banner .highlights .content {
background: #111111;
box-shadow: 0px 0px 4px 1px rgba(255, 255, 255, 0.025); }
#banner .testimonials .content {
background: #111111;
box-shadow: 0px 0px 4px 1px rgba(255, 255, 255, 0.025); }
#banner .testimonials .content .credit strong {
color: #ce1b28; }
#banner > .inner {
-moz-transform: scale(1.0);
-webkit-transform: scale(1.0);
-ms-transform: scale(1.0);
transform: scale(1.0);
-moz-transition: opacity 1s ease, -moz-transform 1s ease;
-webkit-transition: opacity 1s ease, -webkit-transform 1s ease;
-ms-transition: opacity 1s ease, -ms-transform 1s ease;
transition: opacity 1s ease, transform 1s ease;
opacity: 1;
position: relative;
z-index: 3; }
#banner > .inner > :last-child {
margin-bottom: 0; }
#banner h1 {
font-size: 4rem;
margin-bottom: 1rem; }
#banner p {
font-size: 1.5rem; }
#banner a {
color: rgba(255, 255, 255, 0.5);
text-decoration: none; }
#banner a:hover {
color: #ffffff; }
#banner video {
-moz-transform: translateX(50%) translateY(50%);
-webkit-transform: translateX(50%) translateY(50%);
-ms-transform: translateX(50%) translateY(50%);
transform: translateX(50%) translateY(50%);
bottom: 50%;
height: auto;
min-height: 100%;
min-width: 100%;
overflow: hidden;
position: absolute;
right: 50%;
width: auto; }
#banner:before {
-moz-transition: opacity 3s ease;
-webkit-transition: opacity 3s ease;
-ms-transition: opacity 3s ease;
transition: opacity 3s ease;
-moz-transition-delay: 1.25s;
-webkit-transition-delay: 1.25s;
-ms-transition-delay: 1.25s;
transition-delay: 1.25s;
background: #111111;
content: '';
display: block;
height: 100%;
left: 0;
opacity: 0.45;
position: absolute;
top: 0;
width: 100%;
z-index: 1; }
#banner:after {
background: linear-gradient(135deg, #ce1b28 0%, #111111 74%);
content: ' ';
display: block;
height: 100%;
left: 0;
opacity: 0.6;
position: absolute;
top: 0;
webkit-linear-gradientidth: 100%;
width: 100%;
z-index: 1; }
#banner.small {
height: 30vh !important;
min-height: 30vh; }
#media screen and (max-width: 1280px) {
#banner video {
display: none; } }
#media screen and (max-width: 736px) {
#banner {
height: auto !important;
min-height: 0;
padding: 4rem 2rem 4rem 2rem; }
#banner .inner {
width: 100%; }
#banner h1 {
font-size: 1.75rem;
margin-bottom: 0.5rem;
padding-bottom: 0; }
#banner p {
font-size: 1.25rem; }
#banner br {
display: none; }
#banner .button {
width: 100%; } }
#media screen and (max-width: 480px) {
#banner p {
font-size: 1rem; } }
body.is-preload #banner .inner {
-moz-transform: scale(0.99);
-webkit-transform: scale(0.99);
-ms-transform: scale(0.99);
transform: scale(0.99);
opacity: 0; }
body.is-preload #banner:before {
opacity: 1; }
This rule is creating the gradient overlay, so try removing it
#banner:after {
background: linear-gradient(135deg, #ce1b28 0%, #111111 74%);
}
or adding this:
#banner:after {
background: none!important;
}
Should fix it
I need to do a triangular onfocus on button, like on this image
I looked at different examples like this, but the focus zone is rectangular.
Is it possible make triangular onfocus?
You could use clip-path to give a triangular shape to the button and apply the same shape to button::before pseudoelement slightly enlarged to mimic an outline, e.g.
Codepen Demo
Note: working only on browser supporting clip-path
Markup
<button><span>button</span></button>
CSS
button {
position: relative;
border: 0;
padding: 0;
cursor: pointer;
-webkit-clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 50% 100% 0);
clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 50% 100% 0);
}
button span {
position: relative;
z-index: 1;
display: block;
background: linear-gradient(#f4f4f4, #d4d4d4);
padding: 10px 20px;
}
button:focus {
outline: none;
-webkit-clip-path: polygon(0 0, 0 100%, 90% 100%, 100% 50%, 90% 0);
clip-path: polygon(0 0, 0 100%, 90% 100%, 100% 50%, 90% 0);
}
button::before,
button span {
-webkit-clip-path: inherit;
clip-path: inherit;
}
button:focus::before {
content: "";
position: absolute;
height: calc(100% + 4px);
width: calc(100% + 4px);
left: -2px;
top: -2px;
background: rgba(81,153,219, .7);
}
Maybe like this?
Adding an element after the button to provide the triangular shape...
Now it is 45° rotation, you could play by skewing to get another angle.
CodePen Sample
button:hover { border-color: blue; }
button:hover:after { border-color: blue;}
button {
font-size: 14px;
background: none;
border: 1px solid red;
border-right: 0;
position: relative;
height: 44px;
z-index: 1;
background-color: #FFF;
}
button::after {
content: "";
display: block;
position: absolute;
width: 30px; height: 30px;
background: #FFF;
right: -15px;
top: 5px;
transform: rotate(-45deg);
z-index:-1;
border-right: 1px solid Red;
border-bottom: 1px solid Red;
}
You could use the map tag : http://www.w3schools.com/tags/tag_map.asp
But in that case your button must be a picture.
little late,
but you can do for almost every browser with transform and a pseudo.
Eventually add background gradient and shadow : http://codepen.io/gc-nomade/pen/yOjOby
* {
box-sizing: border-box;
}
a {
display: inline-block;
padding: 0.5em 1em;
margin: 0 1.5em 0 0;
text-decoration: none;
color: #177EE5;
border: solid 3px;
border-radius: 5px;
border-right: none;
position: relative;
background: linear-gradient(to right, lightgray, white, lightgray);
box-shadow: 0 0 5px black;
}
a:after {
content: '';
position: absolute;
top: 3px;
bottom: 3px;
right: -.8em;
width: 1.75em;
border-radius: inherit;
border-top: solid;
border-right: solid;
border-color: inherit;
transform: rotate(45deg);
background: linear-gradient(45deg, transparent 45%, lightgray 60%);
box-shadow: 0px -5px 5px -5px black, 5px 0px 5px -5px black
}
arrow
longer arrow
#
you can use this site and make triangular, polygon: The Shapes of CSS - CSS-Tricks
https://css-tricks.com/examples/ShapesOfCSS
make a css class. add that class on focus.
http://www.w3schools.com/jquery/html_addclass.asp
I use the chosen library and my dropdown appear like this, how can I solve this.
Thanks.
Like you can see on the picture the list of values appear under another element instead of being at the first plan, so the list of values is invisible.
What should I change in the CSS to workaround that.
Here is the CSS :
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.2.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011-2014 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/
/* #group Base */
.chosen-container {
position: relative;
display: inline-block;
vertical-align: middle;
font-size: 13px;
zoom: 1;
*display: inline;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.chosen-container * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.chosen-container .chosen-drop {
position: absolute;
top: 100%;
left: -9999px;
z-index: 1010;
width: 100%;
border: 1px solid #aaa;
border-top: 0;
background: #fff;
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
}
.chosen-container.chosen-with-drop .chosen-drop {
left: 0;
}
.chosen-container a {
cursor: pointer;
}
/* #end */
/* #group Single Chosen */
.chosen-container-single .chosen-single {
position: relative;
display: block;
overflow: hidden;
padding: 0 0 0 8px;
height: 25px;
border: 1px solid #aaa;
border-radius: 5px;
background-color: #fff;
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
background-clip: padding-box;
box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
color: #444;
text-decoration: none;
white-space: nowrap;
line-height: 24px;
}
.chosen-container-single .chosen-default {
color: #999;
}
.chosen-container-single .chosen-single span {
display: block;
overflow: hidden;
margin-right: 26px;
text-overflow: ellipsis;
white-space: nowrap;
}
.chosen-container-single .chosen-single-with-deselect span {
margin-right: 38px;
}
.chosen-container-single .chosen-single abbr {
position: absolute;
top: 6px;
right: 26px;
display: block;
width: 12px;
height: 12px;
background: url('chosen-sprite.png') -42px 1px no-repeat;
font-size: 1px;
}
.chosen-container-single .chosen-single abbr:hover {
background-position: -42px -10px;
}
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
background-position: -42px -10px;
}
.chosen-container-single .chosen-single div {
position: absolute;
top: 0;
right: 0;
display: block;
width: 18px;
height: 100%;
}
.chosen-container-single .chosen-single div b {
display: block;
width: 100%;
height: 100%;
background: url('chosen-sprite.png') no-repeat 0px 2px;
}
.chosen-container-single .chosen-search {
position: relative;
z-index: 1010;
margin: 0;
padding: 3px 4px;
white-space: nowrap;
}
.chosen-container-single .chosen-search input[type="text"] {
margin: 1px 0;
padding: 4px 20px 4px 5px;
width: 100%;
height: auto;
outline: 0;
border: 1px solid #aaa;
background: white url('chosen-sprite.png') no-repeat 100% -20px;
background: url('chosen-sprite.png') no-repeat 100% -20px;
font-size: 1em;
font-family: sans-serif;
line-height: normal;
border-radius: 0;
}
.chosen-container-single .chosen-drop {
margin-top: -1px;
border-radius: 0 0 4px 4px;
background-clip: padding-box;
}
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
position: absolute;
left: -9999px;
}
/* #end */
/* #group Results */
.chosen-container .chosen-results {
color: #444;
position: relative;
/*overflow-x: hidden;
overflow-y: auto;*/
margin: 0 4px 4px 0;
padding: 0 0 0 4px;
max-height: 240px;
-webkit-overflow-scrolling: touch;
}
.chosen-container .chosen-results li {
display: none;
margin: 0;
padding: 5px 6px;
list-style: none;
line-height: 15px;
word-wrap: break-word;
-webkit-touch-callout: none;
}
.chosen-container .chosen-results li.active-result {
display: list-item;
cursor: pointer;
}
.chosen-container .chosen-results li.disabled-result {
display: list-item;
color: #ccc;
cursor: default;
}
.chosen-container .chosen-results li.highlighted {
background-color: #3875d7;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
color: #fff;
}
.chosen-container .chosen-results li.no-results {
color: #777;
display: list-item;
background: #f4f4f4;
}
.chosen-container .chosen-results li.group-result {
display: list-item;
font-weight: bold;
cursor: default;
}
.chosen-container .chosen-results li.group-option {
padding-left: 15px;
}
.chosen-container .chosen-results li em {
font-style: normal;
text-decoration: underline;
}
/* #end */
/* #group Multi Chosen */
.chosen-container-multi .chosen-choices {
position: relative;
overflow: hidden;
margin: 0;
padding: 0 5px;
width: 100%;
height: auto !important;
height: 1%;
border: 1px solid #aaa;
background-color: #fff;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
cursor: text;
}
.chosen-container-multi .chosen-choices li {
float: left;
list-style: none;
}
.chosen-container-multi .chosen-choices li.search-field {
margin: 0;
padding: 0;
white-space: nowrap;
}
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
margin: 1px 0;
padding: 0;
height: 25px;
outline: 0;
border: 0 !important;
background: transparent !important;
box-shadow: none;
color: #999;
font-size: 100%;
font-family: sans-serif;
line-height: normal;
border-radius: 0;
}
.chosen-container-multi .chosen-choices li.search-choice {
position: relative;
margin: 3px 5px 3px 0;
padding: 3px 20px 3px 5px;
border: 1px solid #aaa;
max-width: 100%;
border-radius: 3px;
background-color: #eeeeee;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-size: 100% 19px;
background-repeat: repeat-x;
background-clip: padding-box;
box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
color: #333;
line-height: 13px;
cursor: default;
}
.chosen-container-multi .chosen-choices li.search-choice span {
word-wrap: break-word;
}
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
position: absolute;
top: 4px;
right: 3px;
display: block;
width: 12px;
height: 12px;
background: url('chosen-sprite.png') -42px 1px no-repeat;
font-size: 1px;
}
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
background-position: -42px -10px;
}
.chosen-container-multi .chosen-choices li.search-choice-disabled {
padding-right: 5px;
border: 1px solid #ccc;
background-color: #e4e4e4;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
color: #666;
}
.chosen-container-multi .chosen-choices li.search-choice-focus {
background: #d4d4d4;
}
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
background-position: -42px -10px;
}
.chosen-container-multi .chosen-results {
margin: 0;
padding: 0;
}
.chosen-container-multi .chosen-drop .result-selected {
display: list-item;
color: #ccc;
cursor: default;
}
/* #end */
/* #group Active */
.chosen-container-active .chosen-single {
border: 1px solid #5897fb;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.chosen-container-active.chosen-with-drop .chosen-single {
border: 1px solid #aaa;
-moz-border-radius-bottomright: 0;
border-bottom-right-radius: 0;
-moz-border-radius-bottomleft: 0;
border-bottom-left-radius: 0;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
box-shadow: 0 1px 0 #fff inset;
}
.chosen-container-active.chosen-with-drop .chosen-single div {
border-left: none;
background: transparent;
}
.chosen-container-active.chosen-with-drop .chosen-single div b {
background-position: -18px 2px;
}
.chosen-container-active .chosen-choices {
border: 1px solid #5897fb;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
color: #222 !important;
}
/* #end */
/* #group Disabled Support */
.chosen-disabled {
opacity: 0.5 !important;
cursor: default;
}
.chosen-disabled .chosen-single {
cursor: default;
}
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
cursor: default;
}
/* #end */
/* #group Right to Left */
.chosen-rtl {
text-align: right;
}
.chosen-rtl .chosen-single {
overflow: visible;
padding: 0 8px 0 0;
}
.chosen-rtl .chosen-single span {
margin-right: 0;
margin-left: 26px;
direction: rtl;
}
.chosen-rtl .chosen-single-with-deselect span {
margin-left: 38px;
}
.chosen-rtl .chosen-single div {
right: auto;
left: 3px;
}
.chosen-rtl .chosen-single abbr {
right: auto;
left: 26px;
}
.chosen-rtl .chosen-choices li {
float: right;
}
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
direction: rtl;
}
.chosen-rtl .chosen-choices li.search-choice {
margin: 3px 5px 3px 0;
padding: 3px 5px 3px 19px;
}
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
right: auto;
left: 4px;
}
.chosen-rtl.chosen-container-single-nosearch .chosen-search,
.chosen-rtl .chosen-drop {
left: 9999px;
}
.chosen-rtl.chosen-container-single .chosen-results {
margin: 0 0 4px 4px;
padding: 0 4px 0 0;
}
.chosen-rtl .chosen-results li.group-option {
padding-right: 15px;
padding-left: 0;
}
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
border-right: none;
}
.chosen-rtl .chosen-search input[type="text"] {
padding: 4px 5px 4px 20px;
background: white url('chosen-sprite.png') no-repeat -30px -20px;
background: url('chosen-sprite.png') no-repeat -30px -20px;
direction: rtl;
}
.chosen-rtl.chosen-container-single .chosen-single div b {
background-position: 6px 2px;
}
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
background-position: -12px 2px;
}
/* #end */
/* #group Retina compatibility */
#media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
.chosen-rtl .chosen-search input[type="text"],
.chosen-container-single .chosen-single abbr,
.chosen-container-single .chosen-single div b,
.chosen-container-single .chosen-search input[type="text"],
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
.chosen-container .chosen-results-scroll-down span,
.chosen-container .chosen-results-scroll-up span {
background-image: url('chosen-sprite#2x.png') !important;
background-size: 52px 37px !important;
background-repeat: no-repeat !important;
}
}
/* #end */
Elements showing on top or below each other can be managed in css with z-index property. You may apply -1 for the element that comes on the top.
Read more: http://www.w3schools.com/cssref/pr_pos_z-index.asp
Place dropdown inside a div with class 'chosen-upward'
<div class="chosen-upward">
your dropdown with class 'chosen-select'
</div>
Add to style
.chosen-upward.chosen-drop{top:inherit!important; bottom:33px!important;border-bottom-right-radius:0px!important;border-bottom-left-radius:0px!important;border-top-right-radius:4px;border-top-left-radius:4px;box-shadow:none!important;}
This will make the dropdown appear above the select control.
Is it possible to create two arrows like the photo below with css or I have to use a png or svg?
So far
HTML
a {
position: relative;
display: block;
padding-left: 30px;
line-height: 45px;
height: 45px;
}
a:after,
a:before {
right: 100%;
top: 26px;
border-left: 1px solid black;
content: " ";
height: 30px;
width: 25px;
position: absolute;
pointer-events: none;
left: 7px;
}
a:after {
-webkit-transform: rotate(135deg);
left: -11px;
}
a:before {
-webkit-transform: rotate(45deg);
top: 5px;
}
Next
jsfiddle
I can't figure how to put another pair of borders.
Thanks in advance
With a bit of tinkering of your example, it's possible, but you'd probably be better off using another method to draw it or using an icon or icon font.
Here's the fiddle
Achieved with
transform: skew();
rather than rotate.
It's possible, but I would just use a SVG in this case:
http://jsfiddle.net/6v7Np/
HTML
<div class="arrow_box"></div>
<div class="arrow_box alt"></div>
CSS
.arrow_box {
position: relative;
background: #fff;
top:50px;
left:60px;
}
.arrow_box.alt {
left:80px;
}
.arrow_box:after, .arrow_box:before {
right: 100%;
top: 50%;
border: solid transparent;
content:" ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.arrow_box:after {
border-color: rgba(255, 255, 255, 0);
border-right-color: #fff;
border-width: 30px;
margin-top: -30px;
}
.arrow_box:before {
border-color: rgba(0, 0, 0, 0);
border-right-color: #000;
border-width: 31px;
margin-top: -31px;
}
With gradients:
a{
position: relative;
padding-left: 40px;
}
a::before{
content: '';
position: absolute;
width: 40px;
height: 40px;
left: 0;
top: 0;
background-image:
linear-gradient(135deg, transparent 0px, transparent 19px, black 20px, transparent 21px),
linear-gradient(45deg, transparent 0px, transparent 19px, black 20px, transparent 21px),
linear-gradient(135deg, transparent 0px, transparent 19px, black 20px, transparent 21px),
linear-gradient(45deg, transparent 0px, transparent 19px, black 20px, transparent 21px);
background-repeat: no-repeat;
background-size: 50% 50%;
background-position: 0% top, 0% bottom, 50% top, 50% bottom;
/* distance ^ ^ */
}
http://jsfiddle.net/E8sRw/
This is a structure of my site:
<html>
<body>
<embed flash>
<div id='dialog'>
<div width="500px" height="300px"><iframe/></div>
</div>
</body>
</html>
<style type="text/css">
.hide { display: none; }
.show { display: block; }
iframe { border: 0; }
#dialog { background-color: rgba(0,0,0,0.5); position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; }
#dialog .dialog-inside { width: 650px; -webkit-box-shadow: 0px 0px 30px 0px rgba(50, 50, 50, 0.54); -moz-box-shadow: 0px 0px 30px 0px rgba(50, 50, 50, 0.54); box-shadow: 0px 0px 30px 0px rgba(50, 50, 50, 0.54); margin: auto; overflow: hidden; border-radius: 5px; }
#dialog .dialog-inside .dialog-header { position: absolute; right: 0; right: 1px; top: 3px; }
#dialog .dialog-inside .dialog-header .close { width: 23px; height: 23px; background: url("Images/close.png"); background-position: 2px 2px; background-repeat: no-repeat; border: 1px solid transparent; cursor: pointer; }
#dialog .dialog-inside .dialog-header .close:hover { background-color: #fdc985; border-color: #4040B1; }
#dialog .dialog-inside .dialog-bottom-wrapper { position: absolute; bottom: 0px; right: 0; left: 0; height: 42px; background-color: #f8f8f8; }
#dialog .dialog-inside .dialog-bottom-wrapper .dialog-bottom { float: right; margin: 8px 5px; }
#dialog .dialog-inside .dialog-bottom-wrapper .dialog-bottom .btn { background: rgb(251,251,249); /* Old browsers */ /* IE9 SVG, needs conditional override of 'filter' to 'none' */ background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZiZmJmOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmM2YzZWYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); background: -moz-linear-gradient(top, rgba(251,251,249,1) 0%, rgba(243,243,239,1) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(251,251,249,1)), color-stop(100%,rgba(243,243,239,1))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, rgba(251,251,249,1) 0%,rgba(243,243,239,1) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, rgba(251,251,249,1) 0%,rgba(243,243,239,1) 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, rgba(251,251,249,1) 0%,rgba(243,243,239,1) 100%); /* IE10+ */ background: linear-gradient(to bottom, rgba(251,251,249,1) 0%,rgba(243,243,239,1) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fbfbf9', endColorstr='#f3f3ef',GradientType=0 ); /* IE6-8 */ border: 1px solid #7f9db9; color: #333333; cursor: pointer; display: inline-block; margin-left: .5em; padding: 0px 12px; text-align: center; line-height: 20px; outline: none; border-radius: 3px; }
#dialog .dialog-inside .dialog-bottom-wrapper .dialog-bottom .btn:hover { background-color: #d1d1d1; border-color: #d1d1d1; color: #111; moz-transition: background-position 0.1s linear; ms-transition: background-position 0.1s linear; o-transition: background-position 0.1s linear; text-decoration: none; transition: background-position 0.1s linear; webkit-transition: background-position 0.1s linear; outline: none; }
#dialog iframe { display: block; height: 114px; }
</style>
The problem is dialog I set it position: absolute, left, top, bottom, right: 0, in Chrome, IE work fine, it's rendered full screen with black background. Opera, the dialog has width and height is fix with div child => it doesn't have fullscreen. In firefox, it like the same, but I hover on dialog in Inspect Mode, it show black background.
Anyone has the problem like that?
Try adding
height: 100%;
width: 100%;
on #dialog