How to make checkboxes with images - html

I have default checkboxes on my website, with only text on every checkbox(e.g. example).
Does it possible to design the checkboxes to have images on them? and maybe to put "v" mark on a checkbox if it been chosen?
I want it to look something like:

This is how you can simulate an image based checkbox using a label
input {
display: none
}
/* switch image */
label[for="chk1"] {
display: inline-block;
text-align: center;
width: 100px;
height: 100px;
border: 2px solid black;
background: url(http://placehold.it/100/f00);
}
#chk1:checked ~ label[for="chk1"] {
background: url(http://placehold.it/100/ff0);
}
/* add content */
label[for="chk2"] {
display: inline-block;
text-align: center;
width: 100px;
height: 100px;
border: 2px solid black;
position: relative;
}
#chk2:checked ~ label[for="chk2"]::after {
content: 'V';
position: absolute;
left: 0;
right: 0;
font-size: 90px;
font-weight: bold;
font-family: arial;
}
<input id="chk1" type="checkbox">
<input id="chk2" type="checkbox">
<label for="chk1"></label>
<label for="chk2"></label>
<div>Click a box to toggle it</div>

I don't think most people put images in their checkboxes. They either make an image act like a checkbox like #LGSon did, or they wrap an image and checkbox together inside of a div. Something like this:
function toggleCheck(sibling) {
var checkBox = sibling.parentNode.getElementsByTagName("input")[0];
checkBox.checked = !checkBox.checked;
}
.image-box {
width: 150px;
text-align: center;
background: #E9E8E7;
padding: 10px;
-webkit-box-shadow: 2px 2px 5px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 2px 2px 5px 0px rgba(0, 0, 0, 0.75);
box-shadow: 2px 2px 5px 0px rgba(0, 0, 0, 0.75);
border-radius: 5px 5px 5px 5px;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
}
.image-box img {
max-width: 100%;
display: block;
margin-bottom: 7px;
}
<div class="image-box">
<img src="https://3.bp.blogspot.com/-W__wiaHUjwI/Vt3Grd8df0I/AAAAAAAAA78/7xqUNj8ujtY/s1600/image02.png" onClick="toggleCheck(this);" />
<input id="dogs" type="checkbox" name="dogs" value="Dog">
<label for="dogs">I like dogs</label>
</div>

Related

How can I fit a div to its content and align it to the right? [duplicate]

This question already has answers here:
How can I make a div not larger than its contents?
(43 answers)
Closed 1 year ago.
I am trying to make a simple chat application and can't seem to display the chat text belonging to one user stick to the left while the other user's message sticks to the right.
Here is a sample of the code:
.chat-session {
width: 400px;
height: 400px;
border: 1px solid #aaaaaa;
padding: 1%;
}
.user1 {
padding: 0 2px 2px 2px;
border: 1px solid #09aedc4f;
border-radius: 3px;
background-color: #09aedc4f;
margin-bottom: 2px;
}
.user2 {
padding: 0 2px 2px 2px;
text-align: right;
border: 1px solid rgba(0, 128, 0, 0.493);
background-color: rgba(0, 128, 0, 0.493);
margin-bottom: 2px;
border-radius: 3px;
}
<div class="chat-session">
<div class="user1">Hello</div>
<div class="user2">Hi</div>
<div class="user1">What's up?</div>
<div class="user2">Not much</div>
</div>
I would like the divs to fit the text size and user2's div to align right. I have tried display: inline-block; to fit the divs, but that just displays them all on the same line. I have also tried float: right; and float: left; but that also displays them on the same line.
Can someone help?
you could use display with the table-layout algorithm to shrink element to its content, then max-width and margin-left:auto
.chat-session {
width: 400px;
height: 400px;
border: 1px solid #aaaaaa;
padding: 1%;
}
.chat-session>* {/* Update */
display: table;/* for infos : okay with any browser for ages and only from IE8 for MSIE */
max-width: 100%;
}
.user1 {
padding: 0 2px 2px 2px;
border: 1px solid #09aedc4f;
border-radius: 3px;
background-color: #09aedc4f;
margin-bottom: 2px;
}
.user2 {
padding: 0 2px 2px 2px;
text-align: right;
border: 1px solid rgba(0, 128, 0, 0.493);
background-color: rgba(0, 128, 0, 0.493);
margin-bottom: 2px;
border-radius: 3px;
margin-left: auto/* Update */
}
<div class="chat-session">
<div class="user1">Hello</div>
<div class="user2">Hi</div>
<div class="user1">What's up?</div>
<div class="user2">Not much</div>
<div class="user1">What's up? What's up? What's up? What's up? What's up if there a long text here?</div>
<div class="user2">Not much</div>
</div>
Your can put your message tag in another tag with text-align property
.chat-session {
width: 400px;
height: 400px;
border: 1px solid #aaaaaa;
padding: 1%;
}
.user1 {
display:inline;
padding: 0 2px 2px 2px;
border: 1px solid #09aedc4f;
border-radius: 3px;
background-color: #09aedc4f;
margin-bottom: 2px;
}
.user2 {
display:inline;
padding: 0 2px 2px 2px;
border: 1px solid rgba(0, 128, 0, 0.493);
background-color: rgba(0, 128, 0, 0.493);
margin-bottom: 2px;
border-radius: 3px;
}
.message-right{
position: relative;
width: 100%;
text-align: right;
}
.message-left{
position: relative;
width: 100%;
text-align:left;
}
<div class="chat-session">
<div class="message-left"><div class="user1">Hello</div></div>
<div class="message-right"><div class="user2">Hi</div></div>
<div class="message-left"><div class="user1">What's up?</div></div>
<div class="message-right"><div class="user2">Not much</div></div>
</div>

Why wont my css styling of background color ,width, and height work on my last div >gameover?

Why wont my css styling of background color ,width, and height work on my last div >gameover ?
this first part is my html code:
<head>
<title>Maths Game</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-
scalable=yes">
<link rel="stylesheet" href="styling.css">
</head>
<body>
<div id="container">
<div id="score">Score: <span id="scoreValue">0</span></div>
<div id="correct">Correct</div>
<div id="wrong">Try Again</div>
<div id="question">7x7</div>
<div id="instructionBox">Click on the correct answer</div>
<div id="choices">
<div id="box1" class="box">1</div>
<div id="box2" class="box">2</div>
<div id="box3" class="box">3</div>
<div id="box4" class="box">4</div>
</div>
<div id="startReset">start Game</div>
Im guessing right here below is where it started getting messed up:
<div id="timeremaining">Time remaining:<span id="timeRemainingValue">
60</span> sec</div>
<div id="gameOver">
<p>Game Over!</p>
<p>Your score is __</p>
</div>
</div>
this second part is my css code and only the last style "game over" isn't working;
html {
height: 100%;
background: radial-gradient(circle, white, grey);
}
#container {
height: 440px;
width: 550px;
background-color: #9DD2EA;
margin: 100px auto;
/* this line directly above centers the container top and bottom 100px and left and
right to auto so that margin keeps getting
bigger and bigger on both sides till the element is center */
padding: 10px;
border-radius: 20px;
/* above line curves corners of element */
box-shadow: 4px 4px 6px 6px purple;
-webkit-box-shadow: 4px 4px 6px 6px purple;
-moz-box-shadow: 4px 4px 6px 6px purple;
/* [horizontal offset] [vertical offset] [blur radius] [optional spread radius] [color]
*/
position: relative;
}
#score {
background-color: yellow;
padding: 10px;
position: absolute;
left: 475px;
box-shadow: 0px 4px purple;
-moz-box-shadow: 0px 4px purple;
-webkit-box-shadow: 0px 4px purple;
}
#correct {
position: absolute;
left: 240px;
background-color: green;
color: white;
padding: 10px;
display: none;
}
#wrong {
/* line 45 makes it to where this element does not interact with other elements and
other elements behave as if it doesent exist*/
position: absolute;
left: 240px;
background-color: red;
color: white;
padding: 10px;
display: none;
}
#question {
margin: 55px auto 10px auto;
height: 150px;
width: 420px;
background-color: rgb(184, 53, 240);
box-shadow: 0px 4px purple;
font-size: 100px;
text-align: center;
font-family: Arial, Helvetica, sans-serif, sans-serif;
line-height: 150px;
color: black;
border-radius: 5px;
position: relative;
}
#question:active {
box-shadow: 0px 0px purple;
-moz-box-shadow: 0px 0px purple;
-webkit-box-shadow: 0px 0px purple;
top: 4px
}
#instructionBox {
height: 60px;
width: 420px;
background-color: blue;
margin: 1px auto 1px auto;
text-align: center;
line-height: 55px;
box-shadow: 0px 4px purple;
-moz-box-shadow: 0px 4px purple;
-webkit-box-shadow: 0px 4px purple;
border-radius: 5px;
position: relative;
/* transition: all 0.2s; line 71 & 72 with line 77 make the transition happen on click
*/
}
#instructionBox:active {
box-shadow: 0px 0px purple;
-moz-box-shadow: 0px 0px purple;
-webkit-box-shadow: 0px 0px purple;
top: 4px;
}
#choices {
/* background-color: sandybrown; */
height: 100px;
width: 420px;
margin: 10px auto;
color: black;
text-align: center;
line-height: -50px;
margin: 10px auto;
border-radius: 5px;
}
.box {
/*these boxes are within a choices div to help them size together*/
margin-right: 26px;
width: 85px;
height: 85px;
background-color: white;
float: left;
border-radius: 5px;
cursor: pointer;
box-shadow: 0px 4px grey;
-moz-box-shadow: 0px 4px grey;
-webkit-box-shadow: 0px 4px grey;
line-height: 80px;
position: relative;
/* with position relative and .box:active { top: 4px; the box moves down 4px}*/
/* transition: all 0.2s;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-o-transition: all 0.2s;
-ms-transition: all 0.2s; */
}
.box:hover,
#startReset:hover {
background-color: grey;
color: white;
box-shadow: 0px 4px purple;
-webkit-box-shadow: 0px 4px purple;
-moz-box-shadow: 0px 4px purple;
}
.box:active,
#startReset:active {
box-shadow: 0px 0px purple;
-webkit-box-shadow: 0px 0px purple;
-moz-box-shadow: 0px 0px purple;
top: 4px;
}
/* #box1{
margin: 10px 10px;
background-color: red;
width: 30px;
height: 30px;
}
#box2{
margin: 10px 10px;
background-color: white;
width: 30px;
height: 30px;
}
#box3{
margin: 10px 10px;
background-color: blue;
width: 30px;
height: 30px;
}*/
#box4 {
margin-right: 0;
}
#startReset {
/*these boxes are within a choices div to help them size together*/
margin-left: 230px;
width: 100px;
height: 45px;
background-color: rgb(255, 255, 255, 0.5);
float: left;
border-radius: 5px;
cursor: pointer;
box-shadow: 0px 4px grey;
-moz-box-shadow: 0px 4px grey;
-webkit-box-shadow: 0px 4px grey;
line-height: 45px;
text-align: center;
position: relative;
}
/* instead of writing these same pargraphs of code just at the element id to the similar
code alrady made like above */
/* #startReset:hover{
background-color: grey;
color: white;
box-shadow: 0px 4px purple;
-webkit-box-shadow: 0px 4px purple;
-moz-box-shadow: 0px 4px purple;
}
#startReset:active{
box-shadow: 0px 0px purple;
-webkit-box-shadow: 0px 0px purple;
-moz-box-shadow: 0px 0px purple;
top: 4px;
} */
#timeremaining {
/*these boxes are within a choices div to help them size together*/
visibility: hidden;
/* display: none; */
margin-left: 10px;
width: 200px;
height: 45px;
background-color: greenyellow;
float: left;
border-radius: 5px;
cursor: pointer;
box-shadow: 0px 4px grey;
-moz-box-shadow: 0px 4px grey;
-webkit-box-shadow: 0px 4px grey;
line-height: 45px;
text-align: center;
position: relative;
}
this below is the broken part with the >gameover style or gameOver div:
#gameOver {
height: 200px;
width: 500px;
background-color: linear-gradient(blue, green);
font-size: 1.0em;
}

How to make HTML button look pressed in using css?

How do I style a button, with a shadow, so that it looks like it is pressed in?
I tried using box-shadow: ... ;. But this didn't have any affect.
By creatively styling the :active or :focus pseudo classes using a box-shadow: inset ...;
Using the :active pseudo class:
button {
background: #ededed;
border: 1px solid #ccc;
padding: 10px 30px;
border-radius: 3px;
cursor: pointer;
}
button:active {
background: #e5e5e5;
-webkit-box-shadow: inset 0px 0px 5px #c1c1c1;
-moz-box-shadow: inset 0px 0px 5px #c1c1c1;
box-shadow: inset 0px 0px 5px #c1c1c1;
outline: none;
}
<button>
Click me
</button>
Using the :focus pseudo class:
button {
background: #ededed;
border: 1px solid #ccc;
padding: 10px 30px;
border-radius: 3px;
cursor: pointer;
}
button:focus {
background: #e5e5e5;
outline: none;
-webkit-box-shadow: inset 0px 0px 5px #c1c1c1;
-moz-box-shadow: inset 0px 0px 5px #c1c1c1;
box-shadow: inset 0px 0px 5px #c1c1c1;
}
<button>
Click me
</button>
As an alternative to buttons, there is also a possibility to simply use checkbox with the pseudo-class :checked to toggle between states.
label.label-checkbox {
cursor: pointer;
}
label.label-checkbox input {
position: absolute;
top: 0;
left: 0;
visibility: hidden;
pointer-events: none;
}
label.label-checkbox span {
padding: 11px 21px;
border: 1px solid #ccc;
display: inline-block;
color: #202020;
border-radius: 6px;
margin: 7px;
background: #f5f5f5;
user-select: none;
}
label.label-checkbox input:checked + span {
box-shadow: inset 1px 2px 5px #777;
transform: translateY(1px);
background: #e5e5e5;
}
<h1>Pressed buttons with Checkbox</h1>
<label class="label-checkbox">
<input type="checkbox">
<span>Checkbox</span>
</label>
<label class="label-checkbox">
<input type="checkbox" checked>
<span>Styled</span>
</label>
<label class="label-checkbox">
<input type="checkbox">
<span>As</span>
</label>
<label class="label-checkbox">
<input type="checkbox" checked>
<span>Pressed</span>
</label>
<label class="label-checkbox">
<input type="checkbox">
<span>Buttons</span>
</label>
The best way is to nudge the button lower on the page. Using transformY would be the most straight-forward. However that can mess up the layout of other things in the page. So I think that it is better to use margin to temporarily lower the button, such as,
button {
background-color: white;
padding: 10px;
vertical-align: top;
box-shadow: 2px 1px 2px gray;
margin: 4px 10px 4px 10px;
}
button:active {
box-shadow: 0 0 0 white;
margin: 6px 10px 2px 10px;
}
<button>click me</button>
<button>click me</button>
<br>
<button>click me</button>
<button>click me</button>
As in the example, you can take away 2px from the bottom margin, and add 2px to the top margin, therefore you preserve the total size of the button.
You need vertical-align in case there are more than one button.
I think that the best way to make a button looks like it's pressed it's to make it a little darker.
button{
background-color: #03A9F4;
border: none;
padding: 15px 25px;
text-transform: uppercase;
color: white;
font-weight: 700;
border-radius: 3px;
}
button:hover, button:focus{
background-color: #0074a9;
outline: none;
}
<button>Button</button>
If you think visually about what happens when a push-button (like on an old-style stereo system) is pushed in, the button moves back. Visually, the face of the button is darker. The text on the button is inset. The border of the button is dark.
The other answers here all give part of the answer.
This visually does all of the above:
.btnPushed {
color: #efefef; //orig text color was #FFF
text-shadow: -1px -1px 0px #777, -1px -1px 0px #777;
box-shadow: inset 1px 1px 4px #222;
transform: translateY(1px); /* Add per Vince's helpful comment */
}
As you might notice, we apply the styling by adding a class.
$('button').click(function(){
$('button').removeClass('depressed');
$(this).addClass('depressed');
});
button {
border: 1px solid black;
border-radius: 3px;
color: #f5f5f5;
background-color: #b8860b;
background-image: linear-gradient(-180deg,#6699FF,#3473F5 90%);
cursor: pointer;
font-size: 14px;
line-height: 20px;
outline: none; /* Removes Chrome's blue outline */
margin: 2px;
}
button:active{
}
.depressed{
color: #efefef;
text-shadow: -1px -1px 0px #777, -1px -1px 0px #777;
box-shadow: inset 1px 1px 3px #222;
margin: 3px -1px -1px 3px; /* T R B L */
transform: translateY(1px);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<button>Button1</button>
<button>Button2</button>
<button class="depressed">Button3</button>
<button>Button4</button>
To avoid the adjustment (movement) of the other buttons due to the margin change, just put each button into a fix-size div. That way the buttons move around within their divs, without affecting the other buttons inside their own divs.
$('button').click(function(){
$('button').removeClass('depressed');
$(this).addClass('depressed');
});
div {
display: inline-block;
width: 65px;
height: 25px;
}
button {
border: 1px solid black;
border-radius: 3px;
color: #f5f5f5;
background-image: linear-gradient(-180deg,#6699FF,#3473F5 90%);
cursor: pointer;
font-size: 14px;
line-height: 20px;
outline: none; /* Removes Chrome's blue outline */
margin: 2px;
}
button:active{
}
.depressed{
color: #efefef;
text-shadow: -1px -1px 0px #777, -1px -1px 0px #777;
box-shadow: inset 1px 1px 3px #222;
margin: 3px -1px -1px 3px; /* T R B L */
transform: translateY(1px);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<div><button>Button1</button></div>
<div><button>Button2</button></div>
<div><button class="depressed">Button3</button></div>
<div><button>Button4</button></div>
Update:
Added transform: translateY(1px), per Vince's helpful comment below.
.button{
color: white;
background-color: blue;
padding: 8px 25px;
border-radius : 7px;
}
.button:active {
box-shadow: 0 0 0 black;
margin: 3px 0 0 0 ;
}
<input type="button" class="button" value="Enter">
button{
background-color:grey;
padding:10px;
border:none;
color:white;
}
button:hover{
background-color:black;
color:white;
}
<button class"b1">button</button>

Give border to custom shape made by css containing an input type [duplicate]

This question already has answers here:
transparent shape with arrow in upper corner
(2 answers)
Closed 7 years ago.
I have this custom shape made with css. I need to give a border to it but I have unsuccessful so far. How can I give it a border?
.comment-input-container {
width: 96%;
float: left;
}
input[type='text'] {
border: 0px !important;
box-shadow: none;
background-color: #f2f2f2;
box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.1);
padding: 5px;
}
.arrow-left {
float: left;
width: 0;
height: 0;
border-bottom: 10px solid #fff;
border-right: 10px solid #f2f2f2;
}
<div style="width: 300px;">
<div class="arrow-left">
</div>
<div class="comment-input-container">
<input type="text" placeholder="Reply to comment..." />
</div>
</div>
Also, another problem is that the arrow and input break for smaller devices, that is, the input gets stacked underneath the arrow. Is there a better way of creating this shape that is also responsive and stays intact?
Thanks to Harry, I was able to work out a laregely responsive solution:
.comment-input-container {
position: relative;
width: 100%;
border-left: none;
/* not required as the shape needs to be transparent */
border-top-left-radius: 0px;
border-bottom-left-radius: 0px;
}
.comment-input-container:before {
position: absolute;
content: '';
top: 0px;
left: -7px;
height: 26%;
width: 10%;
background-color: #f6f7fb;
border-top: 1px solid #e6e6e6;
border-left: 1px solid #e6e6e6;
-webkit-transform-origin: bottom right;
-webkit-transform: skew(45deg);
-moz-transform: skew(45deg);
transform: skew(45deg);
}
.comment-input-container:after {
position: absolute;
content: '';
left: -7px;
height: 74%;
width: 5%;
max-width: 15px;
bottom: 0px;
border-left: 1px solid #e6e6e6;
border-bottom: 1px solid #e6e6e6;
background-color: #f6f7fb;
}
input[type="text"] {
border: 1px solid #e6e6e6;
border-left: none;
box-shadow: none;
background-color: #f6f7fb;
box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.1) !important;
margin: 0px;
padding: 10px;
outline: none;
}
input[type="text"]:focus {
border: 1px solid #e6e6e6;
border-left: none;
box-shadow: none;
background-color: #f6f7fb !important;
box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.1) !important;
padding: 10px;
outline: none;
}
.comment-box {
margin-left: 50px;
height: 50px;
}
<div class="comment-box">
<div class="comment-input-container">
<input type="text" placeholder="Reply to comment..." />
</div>
</div>
I assume the special shape is the last one? It's 0px x 0px, but you should see something since you gave it a 10px border. Unfortunately, The border is white so it blended in with the white background. I made the shape 1px x 1px and the background black so you can see the shape better.
body { background: black; }
.comment-input-container {
width: 96%;
float: left;
}
input[type='text'] {
border: 0px !important;
box-shadow: none;
background-color: #f2f2f2;
box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.1);
padding: 5px;
}
.arrow-left {
float: left;
width: 1px;
height: 0px;
border-bottom: 10px solid rgba(0, 0, 0, 0.0);
border-right: 10px solid #f2f2f2;
box-shadow: inset 4px 2px 22px 6px rgba(0,0,0,0.57);
outline: 2px inset rgba(0, 0, 0, .35;
}
<div style="width: 300px;">
<div class="arrow-left">
</div>
<div class="comment-input-container">
<input type="text" placeholder="Reply to comment..." />
</div>
</div>

CSS hover partially behind lower elements

I have a situation on a series of forms where I have a hover hint over the input boxes. In a few cases, there is enough text that the hover element wraps to a second line dropping down "over" the next form element below it. The problem is that the hover element actually ends up under rather than over the input box below kind of defeating the purpose.
Any help would be greatly appreciated.
Here is the HTML:
Address1:
" id="address1" />
Your street address.
<div class="field">
<label for="address2">Address2:</label>
<input type="text" class="input" name="address2" value="<?php if ($row_GuestLookup['customer_fname']) { echo $row_GuestLookup['address2']; } ?>" id="address2" />
<p class="hint">Any extra street address information if necessary.</p>
</div>
<div class="field">
<label for="city">City:</label>
<input type="text" class="input" name="city" value="<?php if ($row_GuestLookup['customer_fname']) { echo $row_GuestLookup['city']; } ?>" id="city" />
<p class="hint">Your city.</p>
</div>
And here is the relevant CSS.
#defaultform {
width: 600px;
margin-left: auto;
margin-right: auto;
padding: 20px;
background: #f0f0f0;
overflow:auto;
/* Border style */
border: 1px solid #cccccc;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
/* Border Shadow */
-moz-box-shadow: 2px 2px 2px #cccccc;
-webkit-box-shadow: 2px 2px 2px #cccccc;
box-shadow: 2px 2px 2px #cccccc;
}
.hint{
display: none;
}
.field {
position: relative;
height: 30px;
}
.field:hover .hint {
position: absolute;
display: block;
margin: -30px 0 0 375px;
color: #FFFFFF;
padding: 7px 10px;
background: rgba(0, 0, 0, 0.6);
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
}
Change the z-index of your hint class like so:
.field:hover .hint {
position: absolute;
display: block;
margin: -30px 0 0 375px;
color: #FFFFFF;
padding: 7px 10px;
background: rgba(0, 0, 0, 0.6);
z-index:10000;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
}
Edit:
You may want to use a different value than 10000. I just used that for illustrative purposes.
On .field:hover .hint, you're not getting the benifits of the position: absolute; without specifying a position and value, like top:0px; or the like. I'd suggest making those elements like this:
.field {
position: relative;
height: 30px;
z-index:100;
display:block;
# Just to see if it's collapsing since I can't
# tell if the elements inside are floating too.
float:left;
}
.field:hover .hint {
position: relative;
z-index: 101;
display: block;
margin: -30px 0 0 375px;
color: #FFFFFF;
padding: 7px 10px;
background: rgba(0, 0, 0, 0.6);
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
}
Also make sure the elements inside