I want to change the color of my button when it is active or clicked. I have tried the following Html5 and css3 codes but have not been able to achieved my intentions.
HTML code:
<p class="submit">
<input type = "reset" />
<input type = "submit" />
</p>
CSS3 code:
button.submit:active , button.reset:active {
border: 2px solid #20911e;
box-shadow: 0 0 10px 5px #356b0b inset;
background-color:blue; /* this is the line of interest */
-webkit-box-shadow:0 0 10px 5px #356b0b inset ;
-moz-box-shadow: 0 0 10px 5px #356b0b inset;
-ms-box-shadow: 0 0 10px 5px #356b0b inset;
-o-box-shadow: 0 0 10px 5px #356b0b inset;
}
I am using Chrome for the development, can anyone help me?
In CSS you use selectors in order to define the elements you want to configure. These selectors must match the targeted elements.
If you use the selector
button.submit:active
you're looking for an "button" element that has a class "submit" and is active. But there is no such element in your html code.
I have not the time to give an explanation of all possible selectors of CSS3. But there are good tutorials. This for example:
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started
Change your CSS code to match input elements and add class to input elements.
<p>
<input type = "reset" class="reset"/>
<input type = "submit" class="submit"/>
</p>
input.submit:active , input.reset:active {
border: 2px solid #20911e;
box-shadow: 0 0 10px 5px #356b0b inset;
background-color:blue; /* this is the line of interest */
-webkit-box-shadow:0 0 10px 5px #356b0b inset ;
-moz-box-shadow: 0 0 10px 5px #356b0b inset;
-ms-box-shadow: 0 0 10px 5px #356b0b inset;
-o-box-shadow: 0 0 10px 5px #356b0b inset;
}
Give your buttons a class="submit" and class="reset" respectively. No JavaScript needed. Also change your CSS3 code:
input.submit:active, input.reset:active {....}
Related
I cannot for the life of me figure out how to do this: subscription box.
Should be trivial for experienced devs... problem is the gradient bleeds onto the white of the box, and doesn't end vertically, like so.
It's a simple box underneath the email form, with a gradient applied, and then blur (a lot of it). Ideally, the gradient rectangle's positioning should be anchored to the box.
Example of the code for the box and the gradient can be found here
pastebin^
Maybe this one helps you
box-shadow: 0px 30px 10px 0px #EBEBEB ;
Also, you can see more here
although the below answer is correct! You might only want one side to have the inner shadow as well as use the inset keyword to have the shadow inside the element
.oneside{
-moz-box-shadow: inset 0 6px 6px -6px black;
-webkit-box-shadow: inset 0 6px 6px -6px black;
box-shadow: inset 0 6px 6px -6px black;
border-radius: 4px;
}
.allaround{
-webkit-box-shadow: inset 0 0 5px #000000 ;
-moz-box-shadow: inset 0 0 5px #000000 ;
box-shadow: inset 0 0 5px #000000 ;
border-radius: 4px;
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<body>
<input class="oneside">
one side
</input>
</br>
<input class="allaround">
all around
</input>
</body>
</html>
The Bootstrap framework uses a short syntax to define a box-shadow for div.form-control:focus:
.form-control {
border-color: #3c763d;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.form-control:focus {
border-color: #2b542c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
}
What does the part befor the comma sets? The part after the comma defines the appearance of the shadow, but the part before? Where can I find more info about this?
Searching for this on Google I found a page on w3schools but it seems explain only the part after the comma while I'm don't understanding the part before.
They are using two different box shadows in one statement. The other is an inset border, which is inside instead of outside the element.
Take a look at this CSS-Tricks article for more info about box shadows
How would I make the image glow when hover? I would like to use white-color.
<img src="resources/img/email.png" class="img-circle">
image:
http://i.stack.imgur.com/Hx0kH.png
Can't post link. So, I would like to make it glow (inside), thanks. Any help would be great
I think what you are trying to do is accomplished with two versions of the same image (use of photo editing tools). Then use this code:
<img src="URL of darker image here"
onmouseover="this.src='URL of lighter image';"
onmouseout="this.src='URL of darker image here';">
</img>
You can give glow at the borders using
img:hover
{
-moz-box-shadow: 0 0 5px 5px #ddd;
-webkit-box-shadow: 0 0 5px 5px #ddd;
box-shadow: 0 0 5px 5px #ddd;
}
You can choose the color you want according to your requirements.
you can also visit http://codepen.io/anon/pen/ilqnb
or http://css3generator.com/
You can use box-shadow withInset property
.shadow { -moz-box-shadow: inset 0 0 10px #000000; -webkit-box-shadow: inset 0 0 10px #000000; box-shadow: inset 0 0 10px #000000; }
This question already has an answer here:
Box-Shadow Only on Left and Right
(1 answer)
Closed 8 years ago.
This is css code
.one-edge-shadow {
width:200px;
height:200px;
border-style: solid;
border-width: 1px;
-webkit-box-shadow: 0 8px 6px -6px black;
-moz-box-shadow: 0 8px 6px -6px black;
box-shadow: 0 8px 6px -6px black;
}
Using this style , as I show in this fiddle example , the shadow is at the bottom of the box .
I want to drop shadow to the left and right side of the box .
Actually , I'm little weak in CSS :)
Thanks !
You have to understand the parameters of box-shadow as well as how the drop shadow works (how the light works).
To do what you wish, you need two different shadows, as one light source cannot possible cast shadows on both sides (it could if it was in front of the box, but than you'd have shadow spreading around the up and down edge as well).
Here's the quick answer:
box-shadow: 10px 0 10px -6px black, -10px 0 10px -6px black;
Updated fiddle
What happens here is that you cast a shadow which is offset 10px both to the right and to the left (first parameter offset-x). This alone would achieve what you wish, however, you'd have a blocky shadow (example).
Since you want things to get a bit blurry, you'd have to add the third parameter (blur-radius). Once you do that, you will see the blur creeping from behind your box above and below: that's because behind your box there effectively is another same-sized box, which is however blurred.
To avoid this, you use the fourth parameter (spread-radius) with a negative value to effectively clip the size of the projected box behind your box, so that the top and bottom shadow will be hidden.
Hi Zey this is the code paste in your css and you will get what you want.
This is CSS
.one-edge-shadow {
width:200px;
height:200px;
border-style: solid;
border-width: 1px;
-webkit-box-shadow: 10px 0 10px -6px black, -10px 0 10px -6px black;
-moz-box-shadow: 10px 0 10px -6px black, -10px 0 10px -6px black;
box-shadow: 10px 0 10px -6px black, -10px 0 10px -6px black;
}
This is HTML
<div class="one-edge-shadow"></div>
and check it out in fiddle http://jsfiddle.net/MfV2Y/
Try this:
.one-edge-shadow {
width:200px;
height:200px;
border-style: solid;
border-width: 1px;
-webkit-box-shadow: 10px 0 10px -6px black, -10px 0 10px -6px black;
-moz-box-shadow: 10px 0 10px -6px black, -10px 0 10px -6px black;
box-shadow: 10px 0 10px -6px black, -10px 0 10px -6px black;
}
I am looking at the following template:
http://mojothemes.cosmo-coder.com/dual-flow/Dark/services.html
Can someone explain why there is a shadow area at the base of the
<div id="header-wrapper">
I have looked for a long time with firebug and I cannot see anything that would create the shadow. Not box-shadow on that element. I am interested in using this template but before I use it I would like to find out how this shadow appears.
The shadow is not in #header-wrapper, it's in #page-title
#page-title {
...
-moz-box-shadow: 0 -2px 5px rgba(0,0,0,0.9);
-webkit-box-shadow: 0 -2px 5px rgba(0,0,0,0.9);
box-shadow: 0 -2px 5px rgba(0,0,0,0.9);
}
it's the shadow from <div id="page-title"> moved up
Its not actually the div "header-wrapper" that has the shadow at the base,
Its the below div "page-title" that has the box shadow property.
Also both uses CSS gradient Also
i hope i'm answering correct to you....
box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.9);