Markings in top left corner of a table element - html

I have a left/right scrollable table with two rows and 30+ and growing columns on my homepage. It looks like this:
But I would like to add some titles on "flags" like this:
How could I add "flags" without having to draw transparent PNG and put it on top layer. I was thinking about using canvas, but how could I draw those "flags" which aren't squares and put them in top right corner of every table?
ADD
I like #rick-hitchcock's answer which looks really simple and I tried to implementing it into my webpage. But the "flags" won't seem to render.
Here is how I implemented it:
table.index{
table-layout: fixed;
border-spacing: 20px;
}
table.index td {
height: 190px; /*iz tega se preračuna višina slike v %*/
width: 190px; /*iz tega se preračuna širina slike v %*/
min-width: 190px; /*ne smejo biti manjši - tabela se širi*/
position: relative; /*da deluje spodnja vrstica*/
overflow: hidden;
border-radius: 5px;
border: 1px solid #1A1A1A;
background-color: rgba(0, 0, 0, 0.90);
box-shadow: 0px 0px 8px #000000;
-moz-box-shadow: 0px 0px 8px #000000;
-webkit-box-shadow: 0px 0px 8px #000000;
vertical-align: middle;
text-align: center;
padding: 5px 5px 5px 5px;
}
table.index td img {
position: absolute;
top: 0;
left: 0;
height: auto;
width: 100%;
z-index: -1;
-webkit-transition: all 1.5s ease;
-moz-transition: all 1.5s ease;
-o-transition: all 1.5s ease;
-ms-transition: all 1.5s ease;
transition: all 1.5s ease;
}
table.index td a{
color: #FF3C3F;
}
table.index td p.napis{
opacity: 0.0;
color: white;
text-shadow: 0px 0px 2px #555555;
font-size: 14px;
font-family: ss9;
-webkit-transition: all 1.5s ease;
-moz-transition: all 1.5s ease;
-o-transition: all 1.5s ease;
-ms-transition: all 1.5s ease;
transition: all 1.5s ease;
}
table.index td:hover p.napis{
opacity: 1.0;
}
table.index td:hover{
box-shadow: 0px 0px 15px #000000;
-moz-box-shadow: 0px 0px 15px #000000;
-webkit-box-shadow: 0px 0px 15px #000000;
}
table.index td:hover img {
-webkit-filter: blur(2px) opacity(20%);
-o-filter: blur(2px) opacity(20%);
-ms-filter: blur(2px) opacity(20%);
filter: blur(2px) opacity(20%);
}
div.index {
width: 100%;
overflow-x: auto;
overflow-y: hidden;
-ms-overflow-y: hidden;
}
<!-- THE CODE YOU PROVIDED-->
.container {
position: relative;
overflow: hidden;
display: inline-block;
}
.discount, .event {
position: absolute;
top: 0;
transform: rotate(-45deg);
transform-origin: 50% 250%;
width: 10em;
padding: 0.3em 0;
text-align: center;
border: 1px solid #333;
font: 14px verdana;
}
.discount {
background: #cfc;
}
.event {
background: yellow;
}
<section class="index">
<div class="index">
<table class="index">
<tr>
<td>
<div class="container">
<div class="discount">Discount</div>
<img src="../slike/index/2016-01-18-embedded_world.jpg"/>
<p class="napis">
Obiskali bomo sejem Embedded world v Nürnbergu, kjer si bomo ogledali najnovejšo tehnologijo na področju vgrajenih sistemov. Dijaki ŠC Kranj lahko pri meni prevzamete štiri brezplačne karte z vključenim prevozom!
</p>
</div>
</td>
</tr>
</table>
</div>
</section>
For some reason it won't render as a "flag" but only as a text. Normally it looks like this:
and on mouse hoover it looks like:
Here is my webpage if you want to check it out.

You could use CSS3 transform to rotate a DIV containing the flag.
To make the flag disappear when hovering the table cell, you could do this:
td:hover .discount, td:hover .event {
display: none;
}
That makes it disappear/reappear immediately, which may be a bit jarring. Alternatively, you could transition its opacity like this:
.discount, .event {
transition: 0.5s;
}
td:hover .discount, td:hover .event {
opacity: 0;
}
Snippet:
.index td {
position: relative; /* make the flags relative to their parent td */
overflow: hidden; /* prevent the flags from overflowing the cell */
}
.discount, .event {
position: absolute; /* position the flag absolutely within container */
top: 0; /* top of container */
transform: rotate(-45deg); /* rotate counterclockwise 45 degrees */
transform-origin: 50% 250%; /* experiment to find best placement */
width: 10em; /* width of flag */
text-align: center; /* center the flag's text */
padding: 0.3em 0; /* top and bottom padding */
border: 1px solid #333; /* dark border */
transition: 0.5s; /* transition changed styles in half a second */
font: 14px verdana;
}
.discount {
background: #cfc; /* light green */
}
.event {
background: yellow;
}
.index img {
width: 150px;
border: 1px solid black;
}
td:hover .discount, td:hover .event {
opacity: 0;
}
<table class="index">
<td>
<div class="discount">Discount</div>
<img src="http://ziga-lausegger.com/slike/index/2016-01-18-embedded_world.jpg"/>
<td>
<div class="event">Event</div>
<img src="http://ziga-lausegger.com/slike/index/2015-12-06-comptech.png">
</table>

I think you are looking for something like this: https://jsfiddle.net/DIRTY_SMITH/hywos6cx/
.wrapper {
margin: 50px auto;
width: 150px;
height: 150px;
background: white;
border-radius: 10px;
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
position: relative;
z-index: 90;
}
.ribbon-wrapper-green {
width: 85px;
height: 88px;
overflow: hidden;
position: absolute;
top: -3px;
right: -3px;
}
.ribbon-green {
font: bold 15px Sans-Serif;
color: #333;
text-align: center;
text-shadow: rgba(255, 255, 255, 0.5) 0px 1px 0px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
position: relative;
padding: 7px 0;
left: -5px;
top: 15px;
width: 120px;
background-color: #BFDC7A;
background-image: -webkit-gradient(linear, left top, left bottom, from(#BFDC7A), to(#8EBF45));
background-image: -webkit-linear-gradient(top, #BFDC7A, #8EBF45);
background-image: -moz-linear-gradient(top, #BFDC7A, #8EBF45);
background-image: -ms-linear-gradient(top, #BFDC7A, #8EBF45);
background-image: -o-linear-gradient(top, #BFDC7A, #8EBF45);
color: #6a6340;
-webkit-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3);
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.3);
}
.ribbon-green:before,
.ribbon-green:after {
content: "";
border-top: 3px solid #6e8900;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
position: absolute;
bottom: -3px;
}
.ribbon-green:before {
left: 0;
}
.ribbon-green:after {
right: 0;
}

Related

Why doesn't my flexbox hover effects work as expected in IE 11?

I have instituted a flex-grid in my code, however its not functioning as expected in ie11 (i unfortunately need to have it work there too)—Chrome and Firefox both work fine. What seems to happen is when I load in IE11—the flex boxes only load 1 per line and are no longer hovering appropriately.
I am honestly at a loss here... anything I change breaks Chrome and Firefox.
.flex_row {
display: flex;
flex-flow: row wrap;
justify-content: space-around;
}
.flex_col{
flex: 1;
margin: 10px;
}
.circle_shape {
position: relative;
display: flex;
padding: 50% 0;
border-radius: 50%;
overflow: hidden;
border: 1px solid gray;
font-size: 16px;
font-family: 'Source Sans Pro', sans-serif;
justify-content: center;
align-items: center;
background: radial-gradient(circle at 50% 120%, #81e8f6, #76deef 10%, #055194 80%, #062745 100%);
}
.circle_shape:before {
content: "";
position: absolute;
top: 1%;
left: 5%;
width: 90%;
height: 90%;
border-radius: 50%;
background: radial-gradient(circle at 50% 0px, #ffffff, rgba(255, 255, 255, 0) 58%);
filter: blur(5px);
z-index: 2;
}
.circle_shape:hover{
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1), 0 1px 2px rgba(0,0,0,0.1);
}
.circle_shape img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.circle_shape i{
position: absolute;
text-align: center;
font-size: 4vw;
text-shadow:
0 0 1px #fff,
0 1px 2px rgba(0,0,0,0.3);
}
.circle_shape h2 {
position: absolute;
bottom: 10%;
font-size: 1vw;
font-weight: 800;
text-align: center;
}
.circle_text{
position: absolute;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0,51,102, 0.9);
border-radius: 50%;
width: 100%;
height: 100%;
overflow: hidden;
opacity: 0;
transition: all 0.4s ease-in-out;
transform: scale(0);
}
.circle_text p {
color: #fff;
padding: 4px;
text-align: center;
font-size: calc(7px + .5vw);
text-shadow:
0 0 1px #fff,
0 1px 2px rgba(0,0,0,0.3);
}
.circle_shape:hover .circle_text{
transform: scale(1);
opacity: 1;
}
<div class="flex_row">
<a class="flex_col" href="http://www.cnn.com">
<div class="circle_shape">
<i class="fas fa-sitemap"></i>
<div class="circle_text">
<p>Load me some CNN!</p>
</div>
</div>
<div>
<h2>Beep!</h2>
</div>
</a>
<a class="flex_col" href="http://www.cnn.com">
<div class="circle_shape">
<i class="fas fa-sitemap"></i>
<div class="circle_text">
<p>Load me some ABC!</p>
</div>
</div>
<div>
<h2>BIP!</h2>
</div>
</a>
<a class="flex_col" href="http://www.cnn.com">
<div class="circle_shape">
<i class="fas fa-sitemap"></i>
<div class="circle_text">
<p>Load me some BBC!</p>
</div>
</div>
<div>
<h2>BOOP!</h2>
</div>
</a>
</div>
JSFiddle link
IE 11 partially support flex box. Partial support due to large amount of bugs.
Visit the link for more information.
I try to test with the code in IE 11 and try to modify it for testing purpose. I tried many variations in the code but nothing worked so far.
As a work around, I suggest you to refer example below which is working properly in IE and other browsers.
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 0 rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
z-index: 2;
}
.ch-info {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
}
li {
position: relative;
overflow: hidden;
border-radius: 100%;
}
li img {
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
.ch-info h3 {
color: #fff;
text-transform: uppercase;
position: relative;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 65px 0 0 0;
height: 110px;
font-family: 'Open Sans', Arial, sans-serif;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3);
}
.ch-info p {
color: #fff;
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
}
.ch-info p a {
display: block;
color: #fff;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
text-transform: uppercase;
font-size: 9px;
letter-spacing: 1px;
padding-top: 4px;
font-family: 'Open Sans', Arial, sans-serif;
}
.ch-info p a:hover {
color: #fff222;
color: rgba(255, 242, 34, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 110px rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
#import url('normalize.css');
/* General Demo Style */
body{
font-family: Cambria, Georgia, serif;
background: #f9f9f9 url(../images/bg.jpg);
font-weight: 300;
font-size: 15px;
color: #333;
-webkit-font-smoothing: antialiased;
overflow-y: scroll;
overflow-x: hidden;
}
a{
color: #555;
text-decoration: none;
}
.container{
width: 100%;
position: relative;
}
.clr{
clear: both;
padding: 0;
height: 0;
margin: 0;
}
.main{
width: 90%;
margin: 0 auto;
position: relative;
}
.container > header{
margin: 10px;
padding: 20px 10px 10px 10px;
position: relative;
display: block;
text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
text-align: center;
}
.container > header h1{
font-size: 32px;
line-height: 32px;
margin: 0;
position: relative;
font-weight: 300;
color: #777;
text-shadow: 1px 1px 1px rgba(255,255,255,0.7);
}
.container > header h2{
font-size: 14px;
font-weight: 300;
font-style: italic;
margin: 0;
padding: 15px 0 5px 0;
color: #888;
text-shadow: 1px 1px 1px rgba(255,255,255,0.9);
}
/* Header Style */
.codrops-top{
line-height: 24px;
font-size: 11px;
background: #fff;
background: rgba(255, 255, 255, 0.6);
text-transform: uppercase;
z-index: 9999;
position: relative;
box-shadow: 1px 0px 2px rgba(0,0,0,0.1);
}
.codrops-top a{
padding: 0px 10px;
letter-spacing: 1px;
color: #333;
display: inline-block;
}
.codrops-top a:hover{
background: rgba(255,255,255,0.3);
}
.codrops-top span.right{
float: right;
}
.codrops-top span.right a{
float: left;
display: block;
}
/* Demo Buttons Style */
.codrops-demos{
text-align:center;
display: block;
line-height: 30px;
padding: 5px 0px;
}
.codrops-demos a{
display: inline-block;
font-style: italic;
margin: 0px 4px;
padding: 0px 6px;
color: #aaa;
line-height: 20px;
font-size: 13px;
text-shadow: 1px 1px 1px #fff;
border: 1px solid #fff;
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(47%,#f6f6f6), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* IE10+ */
background: linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.codrops-demos a:hover{
color: #333;
background: #fff;
}
.codrops-demos a:active{
background: #fff;
}
.codrops-demos a.current-demo,
.codrops-demos a.current-demo:hover{
background: #f0f0f0;
border-color: #d9d9d9;
color: #aaa;
box-shadow: 0 1px 1px rgba(255,255,255,0.7);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f6f6f6', endColorstr='#f6f6f6',GradientType=0 ); /* IE6-9 */
}
.support-note span{
color: #ac375d;
font-size: 16px;
display: none;
font-weight: bold;
text-align: center;
padding: 5px 0;
}
.no-cssanimations .support-note span.no-cssanimations,
.no-csstransforms .support-note span.no-csstransforms,
.no-csstransforms3d .support-note span.no-csstransforms3d,
.no-csstransitions .support-note span.no-csstransitions{
display: block;
}
.ch-grid {
margin: 20px 0 0 0;
padding: 0;
list-style: none;
display: block;
text-align: center;
width: 100%;
}
.ch-grid:after,
.ch-item:before {
content: '';
display: table;
}
.ch-grid:after {
clear: both;
}
.ch-grid li {
width: 220px;
height: 220px;
display: inline-block;
margin: 20px;
}
<section class="main">
<ul class="ch-grid">
<li>
<img src="http://tympanus.net/Tutorials/CircleHoverEffects/images/5.jpg" alt="Vision">
<div class="ch-item">
<div class="ch-info">
<h3>Brainiac</h3>
<p>by Daniel Nyari View on Dribbble</p>
</div>
</div>
</li>
</ul>
</section>
Output in IE:
References:
(1) JSFiddle link
(2) Circle Hover Effects with CSS Transitions
Further, you can try to modify the code example as per your requirement.
I just wanted to follow up on this. Rather than rewrite my code -- I decided to hack around it to define a solution.
First step was to identify this is IE 10+ code in my CSS -- i did that through:
#media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
}
I then redefined my flex_container and flex_item as block (using column code as follows) inside the #media query
[class*="flex_item"] {
float: left;
padding: 15px;
}
.flex_container{
display: block;
overflow: hidden;
box-sizing: border-box;
justify-content: center;
align-items: center;
text-align: center;
flex-direction: none;
font-size: 16px;
}
.flex_item {width: 8.33%;box-sizing: border-box;}
I then went through my code and changed any reference to flex to block within that code. Its a lot of duplication but it essentially got me back to #deepak-MSFTs response.
This effectively resolves my issue.

remove css property set for radio btutton inside div

.toggle {
position: relative;
margin: 0 auto;
height: 30px;
width: 65%;
border-radius: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, .3), 0 1px rgba(255, 255, 255, .1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, .3), 0 1px rgba(255, 255, 255, .1);
background: #AAA;
text-shadow: none;
font-weight: 400
}
.chngamt-head,
.toggle-label:active {
font-weight: 700
}
.toggle-label {
position: relative;
z-index: 2;
float: left;
width: 49%;
line-height: 30px;
font-size: 10px;
color: rgba(255, 255, 255, .87);
text-align: center
}
.toggle-label-off {
padding-left: 2px
}
.stylechngbut,
.styleinpamt {
margin-bottom: 15px;
padding: 15px
}
.toggle-input {
display: none
}
.toggle-input:checked+.toggle-label {
color: rgba(0, 0, 0, .65);
-webkit-transition: .15s ease-out;
-moz-transition: .15s ease-out;
-o-transition: .15s ease-out;
transition: .15s ease-out
}
.toggle-input:checked+.toggle-label-on~.toggle-selection {
left: 50%
}
.toggle-selection {
display: block;
position: absolute;
z-index: 1;
top: 2px;
left: 2px;
width: 49%;
height: 26px;
background: #65bd63;
border-radius: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
background-image: -webkit-linear-gradient(top, #9dd993, #65bd63);
background-image: -moz-linear-gradient(top, #9dd993, #65bd63);
background-image: -o-linear-gradient(top, #9dd993, #65bd63);
background-image: linear-gradient(to bottom, #9dd993, #65bd63);
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, .5), 0 0 2px rgba(0, 0, 0, .2);
box-shadow: inset 0 1px rgba(255, 255, 255, .5), 0 0 2px rgba(0, 0, 0, .2);
-webkit-transition: left .15s ease-out;
-moz-transition: left .15s ease-out;
-o-transition: left .15s ease-out;
transition: left .15s ease-out
}
.toggle-blue .toggle-selection {
background: #FCCD17;
background-image: -webkit-linear-gradient(top, #fff3b2, #fccd17);
background-image: -moz-linear-gradient(top, #fff3b2, #fccd17);
background-image: -o-linear-gradient(top, #fff3b2, #fccd17);
background-image: linear-gradient(to bottom, #fff3b2, #fccd17)
}
.toggle-yellow .toggle-selection {
background: #c4bb61;
background-image: -webkit-linear-gradient(top, #e0dd94, #c4bb61);
background-image: -moz-linear-gradient(top, #e0dd94, #c4bb61);
background-image: -o-linear-gradient(top, #e0dd94, #c4bb61);
background-image: linear-gradient(to bottom, #e0dd94, #c4bb61)
}
[type="radio"]:not(:checked),
[type="radio"]:checked {
position: absolute;
left: -9999px;
}
[type="radio"]:not(:checked)+label,
[type="radio"]:checked+label {
position: relative;
padding-left: 55px;
cursor: pointer;
margin: 0;
width: 100%;
}
/* checkbox aspect */
[type="radio"]:not(:checked)+label::before,
[type="radio"]:checked+label::before {
background: #000000 none repeat scroll 0 0;
border-radius: 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) inset;
content: "";
height: 45px;
left: 0;
position: absolute;
top: 0;
width: 45px;
}
/* checked mark aspect */
[type="radio"]:not(:checked)+label:after,
[type="radio"]:checked+label:after {
color: #ffffff;
content: "✔";
font-size: 18px;
left: 14px;
line-height: 0.8;
position: absolute;
top: 17px;
transition: all 0.2s ease 0s;
}
/* checked mark aspect changes */
[type="radio"]:not(:checked)+label:after {
opacity: 0;
transform: scale(0);
}
[type="radio"]:checked+label:after {
opacity: 1;
transform: scale(1);
}
/* disabled checkbox */
[type="radio"]:disabled:not(:checked)+label:before,
[type="radio"]:disabled:checked+label:before {
box-shadow: none;
border-color: #bbb;
background-color: #fff;
}
[type="radio"]:disabled:checked+label:after {
color: #fff;
}
[type="radio"]:disabled+label {
color: #aaa;
}
/* accessibility */
[type="radio"]:checked:focus+label:before,
[type="radio"]:not(:checked):focus+label:before {
border: 1px dotted blue;
}
/* hover style just for information */
label:hover:before {
border: 1px solid #4778d9!important;
}
[type="radio"]:checked+label {
background: #FFDF66;
}
<div class="toggle toggle-blue reset-this">
<input type="radio" class="toggle-input " name="SchemeType" value="R" id="LStoggle" checked />
<label for="LStoggle" class="toggle-label toggle-label-off">
Male
</label>
<input type="radio" class="toggle-input" name="SchemeType" value="D" id="SIPtoggle" />
<label for="SIPtoggle" class="toggle-label toggle-label-on">
female
</label>
<span class="toggle-selection"></span>
</div>
i am using css property [type="radio"] for radio button outside class toggle div but radio button inside class toggle should not use css property [type="radio"] it should remove the css property set for radio button outside class toggle div i used css combinator but its not working i want following output jsfiddle any help will be appreciated

How to animate input box from page center to the top of the page on input focus in css?

I think this is very simple, but I'm not sure how it's implemented. So let's say I have an input field that is originally centered to the page (vertically & horizontally). However, I want to animate the input box to the top of the page when the user starts typing, how would this be implemented? My initial thought would be to assign the top:0 and transform it on focus. Is it more complex than that?
Please enlighten me.
input.input-student-search {
position: absolute;
top: 50%;
transform: translateY(0px);
padding: 27px 145px 27px 38px;
margin: 10px;
width: 100%;
border: none;
box-shadow: 0 10px 20px rgba(198, 198, 198, 0.02), 0 6px 6px rgba(221, 221, 221, 0.23);
border-radius: 6px;
text-align: left;
&:focus {
top: 0;
}
}
This is how I did it:
.txt {
position: relative;
text-align: center;
width: 90%;
margin: 0 20px 0 20px;
top: 200px;
transition: top 0.4s;
}
.txt:focus{
top:0;
}
Here is the JSFiddle demo
Just put top:0 in a :focus style:
input.input-student-search:focus {
top:0;
}
input.input-student-search {
background-color:#AAA;
position: absolute;
top: 50%;
transform: translateY(0px);
padding: 27px 145px 27px 38px;
margin: 10px;
width: 100%;
border: none;
box-shadow: 0 10px 20px rgba(198, 198, 198, 0.02), 0 6px 6px rgba(221, 221, 221, 0.23);
border-radius: 6px;
text-align: left;
transition:top 1s linear;
}
input.input-student-search:focus {
top:0;
}
<input class="input-student-search" type="text"/>

Position two absolute divs inside anchor tag

I have been trying to make a link fade effect in CSS. There are two divs inside a tag, the top one fades away on hover revealing the inner content.
However when the inside div has larger content it just overflows.I realize this is due to the position:absolute and so its width is ignored by the parent a.
Is there a way the parent a could take the biggest width of the two divs ?
My code here:
The first link works as expected because the inner div has lesser contentThe second link is the one describing this problem.
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
margin: 0px;
padding: 0px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
text-align: center;
}
a,
a:hover,
a:focus,
a:active {
text-decoration: none;
outline: none;
color: #444;
}
a.fade {
border: 1px solid #ddd;
overflow: hidden;
display: inline-block;
}
a.fade > div {
display: inline-block;
padding: 10px 15px 10px 15px;
-moz-transition: all 0.3s ease-in;
-o-transition: all 0.3s ease-in;
-webkit-transition: all 0.3s ease-in;
transition: all 0.3s ease-in;
text-align: center;
}
a.fade>div:first-child {
position: absolute;
}
a.fade > div:last-child {
z-index: 1;
position: relative;
background-color: #ffaaaa;
opacity: 1;
left: 0px;
top: 0px;
-moz-box-shadow: 1px 1px 3px 1px rgba(00, 0, 0, 0.2);
-webkit-box-shadow: 1px 1px 3px 1px rgba(00, 0, 0, 0.2);
box-shadow: 1px 1px 3px 1px rgba(00, 0, 0, 0.2);
}
a.fade:hover {
-moz-box-shadow: inset 0px 0px 3px 1px rgba(00, 0, 0, 0.2);
-webkit-box-shadow: inset 0px 0px 3px 1px rgba(00, 0, 0, 0.2);
box-shadow: inset 0px 0px 3px 1px rgba(00, 0, 0, 0.2);
}
a.fade:hover > div:last-child {
opacity: 0;
}
<a href="#" class="fade">
<div>Content inside</div>
<div>This one fades</div>
</a>
<a href="#" class="fade">
<div>Content inside</div>
<div>This fades</div>
</a>
Any kind of workaround in html structure is appreciated as well, as long as the final thing is achieved.
You will be able to achieve it using absolute positioning. But the same thing needs the parent to be relative one.
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
margin: 0px;
padding: 0px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
text-align: center;
}
a,
a:hover,
a:focus,
a:active {
text-decoration: none;
outline: none;
color: #444;
}
a.fade {
border: 1px solid #ddd;
overflow: hidden;
display: inline-block;
position: relative;
}
a.fade > span {
display: inline-block;
padding: 10px 15px 10px 15px;
-moz-transition: all 0.3s ease-in;
-o-transition: all 0.3s ease-in;
-webkit-transition: all 0.3s ease-in;
transition: all 0.3s ease-in;
text-align: center;
}
a.fade > span:first-child {
position: relative;
z-index: 1;
}
a.fade > span:last-child {
z-index: 1;
position: absolute;
background-color: #ffaaaa;
opacity: 1;
left: 0;
top: 0;
right: 0;
bottom: 0;
-moz-box-shadow: 1px 1px 3px 1px rgba(00, 0, 0, 0.2);
-webkit-box-shadow: 1px 1px 3px 1px rgba(00, 0, 0, 0.2);
box-shadow: 1px 1px 3px 1px rgba(00, 0, 0, 0.2);
}
a.fade:hover {
-moz-box-shadow: inset 0px 0px 3px 1px rgba(00, 0, 0, 0.2);
-webkit-box-shadow: inset 0px 0px 3px 1px rgba(00, 0, 0, 0.2);
box-shadow: inset 0px 0px 3px 1px rgba(00, 0, 0, 0.2);
}
a.fade:hover > span:last-child {
opacity: 0;
}
<a href="#" class="fade">
<span>Content inside</span>
<span>This one fades</span>
</a>
<a href="#" class="fade">
<span>Content inside</span>
<span>This fades</span>
</a>
Please note that you have to make a { display: block; /* or inline-block */ } for your HTML to stay valid. Otherwise a cannot contain block level elements.
Instead of absolute positioning, you can use a relative positioning and a negative bottom margin on the second div and set a background-color on the first, pulling the second div behind the first. Then you could transition opacity on the first div on hover. This will require setting a higher z-index on the second div than on the first.
a {
border: 20px solid blue;
display: inline-block;
color: #fff;
}
a :first-child {
background-color: #a00;
position: relative;
transition-duration: 0.2s;
z-index: 3;
}
a :last-child {
background-color: #0a0;
margin-bottom: -1.2em;
position: relative;
top: -1.2em;
z-index: 2;
}
a:hover :first-child {
opacity: 0;
}
<a href="#">
<div>Linktext</div>
<div>Longer Link text on hover</div>
</a>

How to get Circle Hover Effects with CSS Transitions with img tag?

I want Circle Hover Effects with CSS Transitions on <img> tag without calling the image as background image.
I have created a JSFiddle of the effect I want. But in this fiddle, image is used as a background image. I want same effect, but with image in an img tag, not as background image.
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 0 rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
.ch-img-1 {
background-image: url(http://tympanus.net/Tutorials/CircleHoverEffects/images/5.jpg);
}
.ch-img-2 {
background-image: url(http://tympanus.net/Tutorials/CircleHoverEffects/images/5.jpg);
}
.ch-img-3 {
background-image: url(http://tympanus.net/Tutorials/CircleHoverEffects/images/5.jpg);
}
.ch-info {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
}
.ch-info h3 {
color: #fff;
text-transform: uppercase;
position: relative;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 65px 0 0 0;
height: 110px;
font-family: 'Open Sans', Arial, sans-serif;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3);
}
.ch-info p {
color: #fff;
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
}
.ch-info p a {
display: block;
color: #fff;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
text-transform: uppercase;
font-size: 9px;
letter-spacing: 1px;
padding-top: 4px;
font-family: 'Open Sans', Arial, sans-serif;
}
.ch-info p a:hover {
color: #fff222;
color: rgba(255, 242, 34, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 110px rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
#import url('normalize.css');
/* General Demo Style */
body {
font-family: Cambria, Georgia, serif;
background: #f9f9f9 url(../images/bg.jpg);
font-weight: 300;
font-size: 15px;
color: #333;
-webkit-font-smoothing: antialiased;
overflow-y: scroll;
overflow-x: hidden;
}
a {
color: #555;
text-decoration: none;
}
.container {
width: 100%;
position: relative;
}
.clr {
clear: both;
padding: 0;
height: 0;
margin: 0;
}
.main {
width: 90%;
margin: 0 auto;
position: relative;
}
.container > header {
margin: 10px;
padding: 20px 10px 10px 10px;
position: relative;
display: block;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
text-align: center;
}
.container > header h1 {
font-size: 32px;
line-height: 32px;
margin: 0;
position: relative;
font-weight: 300;
color: #777;
text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.7);
}
.container > header h2 {
font-size: 14px;
font-weight: 300;
font-style: italic;
margin: 0;
padding: 15px 0 5px 0;
color: #888;
text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.9);
}
/* Header Style */
.codrops-top {
line-height: 24px;
font-size: 11px;
background: #fff;
background: rgba(255, 255, 255, 0.6);
text-transform: uppercase;
z-index: 9999;
position: relative;
box-shadow: 1px 0px 2px rgba(0, 0, 0, 0.1);
}
.codrops-top a {
padding: 0px 10px;
letter-spacing: 1px;
color: #333;
display: inline-block;
}
.codrops-top a:hover {
background: rgba(255, 255, 255, 0.3);
}
.codrops-top span.right {
float: right;
}
.codrops-top span.right a {
float: left;
display: block;
}
/* Demo Buttons Style */
.codrops-demos {
text-align: center;
display: block;
line-height: 30px;
padding: 5px 0px;
}
.codrops-demos a {
display: inline-block;
font-style: italic;
margin: 0px 4px;
padding: 0px 6px;
color: #aaa;
line-height: 20px;
font-size: 13px;
text-shadow: 1px 1px 1px #fff;
border: 1px solid #fff;
background: #ffffff;
/* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color-stop(47%, #f6f6f6), color-stop(100%, #ededed));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
/* IE10+ */
background: linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
/* W3C */
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed', GradientType=0);
/* IE6-9 */
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.codrops-demos a:hover {
color: #333;
background: #fff;
}
.codrops-demos a:active {
background: #fff;
}
.codrops-demos a.current-demo,
.codrops-demos a.current-demo:hover {
background: #f0f0f0;
border-color: #d9d9d9;
color: #aaa;
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#f6f6f6', endColorstr='#f6f6f6', GradientType=0);
/* IE6-9 */
}
.support-note span {
color: #ac375d;
font-size: 16px;
display: none;
font-weight: bold;
text-align: center;
padding: 5px 0;
}
.no-cssanimations .support-note span.no-cssanimations,
.no-csstransforms .support-note span.no-csstransforms,
.no-csstransforms3d .support-note span.no-csstransforms3d,
.no-csstransitions .support-note span.no-csstransitions {
display: block;
}
.ch-grid {
margin: 20px 0 0 0;
padding: 0;
list-style: none;
display: block;
text-align: center;
width: 100%;
}
.ch-grid:after,
.ch-item:before {
content: '';
display: table;
}
.ch-grid:after {
clear: both;
}
.ch-grid li {
width: 220px;
height: 220px;
display: inline-block;
margin: 20px;
}
<section class="main">
<ul class="ch-grid">
<li>
<div class="ch-item ch-img-1">
<div class="ch-info">
<h3>Brainiac</h3>
<p>by Daniel Nyari View on Dribbble
</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-2">
<div class="ch-info">
<h3>Vision</h3>
<p>by Daniel Nyari View on Dribbble
</p>
</div>
</div>
</li>
<li>
<div class="ch-item ch-img-3">
<div class="ch-info">
<h3>Cylon</h3>
<p>by Daniel Nyari View on Dribbble
</p>
</div>
</div>
</li>
</ul>
</section>
I've edited your fiddle here: http://jsfiddle.net/pedwf80h/7/
Essentially I've moved the img url from the background to within the li element. Then positioned the img absolutely and used z-index to move it to the back. The li element then uses overflow: hidden and border-radius: 100% to hide any of the image that goes outside of our li element.
Hope this helps!
Try this may be this can help for you:
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 0 rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
z-index: 2;
}
.ch-info {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
opacity: 0;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
-o-transition: all 0.4s ease-in-out;
-ms-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
-webkit-transform: scale(0);
-moz-transform: scale(0);
-o-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-backface-visibility: hidden;
}
li {
position: relative;
overflow: hidden;
border-radius: 100%;
}
li img {
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
.ch-item:hover {
box-shadow: inset 0 0 0 110px rgba(200, 95, 66, 0.4), inset 0 0 0 16px rgba(255, 255, 255, 0.8), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-o-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
#import url('normalize.css');
/* General Demo Style */
body{
font-family: Cambria, Georgia, serif;
background: #f9f9f9 url(../images/bg.jpg);
font-weight: 300;
font-size: 15px;
color: #333;
-webkit-font-smoothing: antialiased;
overflow-y: scroll;
overflow-x: hidden;
}
a{
color: #555;
text-decoration: none;
}
.container{
width: 100%;
position: relative;
}
.clr{
clear: both;
padding: 0;
height: 0;
margin: 0;
}
.main{
width: 90%;
margin: 0 auto;
position: relative;
}
.container > header{
margin: 10px;
padding: 20px 10px 10px 10px;
position: relative;
display: block;
text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
text-align: center;
}
.container > header h1{
font-size: 32px;
line-height: 32px;
margin: 0;
position: relative;
font-weight: 300;
color: #777;
text-shadow: 1px 1px 1px rgba(255,255,255,0.7);
}
.container > header h2{
font-size: 14px;
font-weight: 300;
font-style: italic;
margin: 0;
padding: 15px 0 5px 0;
color: #888;
text-shadow: 1px 1px 1px rgba(255,255,255,0.9);
}
/* Header Style */
.codrops-top{
line-height: 24px;
font-size: 11px;
background: #fff;
background: rgba(255, 255, 255, 0.6);
text-transform: uppercase;
z-index: 9999;
position: relative;
box-shadow: 1px 0px 2px rgba(0,0,0,0.1);
}
.codrops-top a{
padding: 0px 10px;
letter-spacing: 1px;
color: #333;
display: inline-block;
}
.codrops-top a:hover{
background: rgba(255,255,255,0.3);
}
.codrops-top span.right{
float: right;
}
.codrops-top span.right a{
float: left;
display: block;
}
/* Demo Buttons Style */
.codrops-demos{
text-align:center;
display: block;
line-height: 30px;
padding: 5px 0px;
}
.codrops-demos a{
display: inline-block;
font-style: italic;
margin: 0px 4px;
padding: 0px 6px;
color: #aaa;
line-height: 20px;
font-size: 13px;
text-shadow: 1px 1px 1px #fff;
border: 1px solid #fff;
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(47%,#f6f6f6), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* IE10+ */
background: linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.codrops-demos a:hover{
color: #333;
background: #fff;
}
.codrops-demos a:active{
background: #fff;
}
.codrops-demos a.current-demo,
.codrops-demos a.current-demo:hover{
background: #f0f0f0;
border-color: #d9d9d9;
color: #aaa;
box-shadow: 0 1px 1px rgba(255,255,255,0.7);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f6f6f6', endColorstr='#f6f6f6',GradientType=0 ); /* IE6-9 */
}
.support-note span{
color: #ac375d;
font-size: 16px;
display: none;
font-weight: bold;
text-align: center;
padding: 5px 0;
}
.no-cssanimations .support-note span.no-cssanimations,
.no-csstransforms .support-note span.no-csstransforms,
.no-csstransforms3d .support-note span.no-csstransforms3d,
.no-csstransitions .support-note span.no-csstransitions{
display: block;
}
.ch-grid {
margin: 20px 0 0 0;
padding: 0;
list-style: none;
display: block;
text-align: center;
width: 100%;
}
.ch-grid:after,
.ch-item:before {
content: '';
display: table;
}
.ch-grid:after {
clear: both;
}
.ch-grid li {
width: 220px;
height: 220px;
display: inline-block;
margin: 20px;
}
<section class="main">
<ul class="ch-grid">
<li>
<img src="http://tympanus.net/Tutorials/CircleHoverEffects/images/5.jpg" alt="Vision">
<div class="ch-item">
<div class="ch-info">
</div>
</div>
</li>
</ul>
</section>
Additional reference website...
Reference link
#import url(http://fonts.googleapis.com/css?family=Cabin:700);
body {
padding-top: 2em;
background-color: #c02227;
}
.circle-container {
position: relative;
perspective: 1000;
margin: 0 auto;
}
.circle-container:hover .circle {
transform: rotate3d(45, 45, 0, 180deg);
}
.circle-container:hover .outer-ring {
transform: rotate3d(45, 0, 0, 180deg);
}
.circle-container:hover .outer-outer-ring {
transform: rotate3d(0, 45, 0, 180deg);
}
.circle-container, .front, .back {
width: 175px;
height: 175px;
background-color: rgba(0,0,0,0);
}
.circle, .outer-ring, .outer-outer-ring {
transition: 0.5s;
transform-style: preserve-3d;
transition-timing-function: cubic-bezier(0.785, 0.135, 0.150, 0.860);
}
.circle {
position: relative;
width: 175px;
height: 175px;
}
.front, .back {
border-radius: 50%;
box-shadow: 0px 0px 20px rgba(0,0,0,0.4);
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
.front {
background-color: #fff;
z-index: 2;
}
.front p {
margin-top: 1.2em;
font-family: cabin, sans-serif;
font-weight: 700;
font-size: 3em;
text-align: center;
color: #c02227;
}
.back {
transform: rotate3d(45,45,0,180deg);
background-color: #fff;
}
.back-logo {
width: 60%;
display: block;
margin: 2em auto;
}
.outer-ring {
position: absolute;
top: -10px;
left: -10px;
border-radius: 50%;
border: 2px solid #fff;
width: 191px;
height: 191px;
background-color: rgba(255,255,255,0);
box-shadow: 0px 0px 20px rgba(0,0,0,0.4);
}
.outer-outer-ring {
position: absolute;
top: -20px;
left: -20px;
border-radius: 50%;
border: 2px solid #fff;
width: 211px;
height: 211px;
background-color: rgba(255,255,255,0);
box-shadow: 0px 0px 20px rgba(0,0,0,0.4);
}