Is there a way to influence only separate box-shadow properties?
For instance I have these classes to set button size and button color
.btn {
background: gray;
font-size: 15px;
box-shadow: 0 2px 0 0 dark-gray;
}
.btn--primary {
background: blue;
box-shadow: 0 2px 0 0 dark-blue;
}
.btn--secondary {
background: red;
box-shadow: 0 2px 0 0 dark-red;
}
.btn--large {
font-size: 20px;
}
But now, I also want a larger box shadow on .btn--large
Problem is, I have multiple colored buttons, so I would need some sort of "box-shadow-y-size property"
How do you work around this problem? The only way I can think of right now is to do something like this...
.btn--large.btn--primary {
box-shadow: 0 4px 0 0 dark-blue;
}
.btn--large.btn--secondary {
box-shadow: 0 4px 0 0 dark-red;
}
There is sadly only one way to define a box-shadow, but in your case there might be a work-around. If you don't specify a colour for your box-shadow it will default to the colour of the color attribute. Perhaps this is something you can make use of.
For example, if you want to be able to have a differently coloured box-shadow while still retaining the original text color, one way you can achieve this by applying the box-shadow to a :before pseudo element instead of the element itself.
JSFiddle with pseudo element solution
Related
We are using different static images as per year to display.
I want to make it dynamic by adding image without number and adding number. Its looks good except. I tried text-shadow css property but does not give same result like image.
Is it possible to add shadow by css which goes to end of left corner?
You probably have to use multiples text-shadow to achieve this style.
text-shadow: 1px 1px 0 #087194, 2px 2px 0 #087194, 3px 3px 0 #087194, 4px 4px 0 #087194, 5px 5px 0 #087194;
https://jsfiddle.net/h462ruey/33/
I'm using SaaS for building my own webshop. The problem is that i dont know any code. I wish to make my menu bar look more stylish. The SaaS platform offers CSS editing but i can't change the html.
The current menu bar has this css;
#menu {
padding: 5px 0 5px 0;
background: #005775;
margin: 0 0 8px 0;
}
How can I make this better looking. I tried changing the opacity, but every time i add the word opacity the code breaks and the memu disappears.
My current Design looks like this;
http://imgur.com/a/ptSuA
I would really like to make the Menu bar a bit less rough and make it look more friendly.
Sorry for my horrible grammar and lack of knowledge.
try using
background-color:rgba() instead of opacity
this adds transparency to the menu bar.
example
background-color:rgba(255,0,0,0.5);
the last value adds transparency.
When you added opacity to #menu, it affect on All his Childrens and menu disappears.you must use of background-color:rgba() or background-color:hsla()
#005775 = rgba(0, 87, 117, 1.0)
#005775 = hsla(195, 100%, 23%, 1.0)
So :
#menu {
width: 200px;
height: 200px;
padding: 5px 0 5px 0;
margin: 0 0 8px 0;
background:rgba(0, 87, 117, 0.3);/*/ I use 0.3 /*/
}
<div id="menu">I Am Menu</div>
Try this. As said by others, this will reduce the opacity of the text in the menu too.
#menu {
padding: 5px 0 5px 0;
background: #005775;
margin: 0 0 8px 0;
opacity: 0.5; // Change this value between 0(transparent) -> 1(100% visible);
}
Hey so my friend runs this web company. He told me he wanted to make some changes to his site. And if I showed him I could handle it, he'd hire me for some stuff.
Most of it I handled fine. But I can't figure out this for the life of me.
If you go to his site (linked below) and hover over the round plus icon under recent work. The shadow switches to blue. I want it to stay orange though.
Any ideas?
p.s. i changed the icon color, shadow color etc... just can't figure out how to change this one thing.
*link removed
Thanks!
relevant code below :
.posts-grid.works li .featured-thumbnail .zoom-icon::after {
background: #E35F33 none repeat scroll 0% 0%;
}
.posts-grid.works li .featured-thumbnail .zoom-icon {
box-shadow: 0px 0px 0px 6px rgba(227, 95, 51, 0.2);
}
Your issue is one of CSS specificity:
Here's the selector you're trying to overwrite:
.posts-grid.works li .featured-thumbnail .zoom-icon:hover { ... }
Here's your selector:
.posts-grid.works li .featured-thumbnail .zoom-icon { ... }
If you can't or don't want to remove the first selector, make your selector more specific.
Ref:
Specificity - CSS | MDN
You can remove the following code:
.posts-grid.works li .featured-thumbnail .zoom-icon:hover {
-webkit-box-shadow:0 0 0 6px rgba(90,206,205,0.4);
-moz-box-shadow:0 0 0 6px rgba(90,206,205,0.4);
box-shadow:0 0 0 6px rgba(90,206,205,0.4);
}
This seems to fix the issue.
I have added a button styling to a div. The background-color does not apply to the normal state. However, as soon as I click down on the button and turn it into an active state, the background-color applies correctly. I cannot figure out why the background-color only appears in one stage and not the other. I have resorted to using !important to make it work. Below is the CSS:
.statusbutton {
-moz-box-shadow:inset 0 1px 0 0 #ffffff;
-webkit-box-shadow:inset 0 1px 0 0 #ffffff;
box-shadow:inset 0 1px 0 0 #ffffff;
height:43px;
width:40px;
border:1px solid #ccc;
-moz-border-radius:2px;
-webkit-border-radius:2px;
border-radius:2px;
display:inline-block;
background-color:#fbfbfb !important;
}
.statusbutton:active {
position:relative;
background-color:#fbfbfb;
top:1px;
}
EDIT: I realized the issue came from a later part of my stylesheet:
.red {
background:url(status-red.png) no-repeat center center;
}
I applied .red to the button afterwards, which caused the background image to override the background-color. The code below ended up fixing the issue:
.red {
background:url(status-red.png) no-repeat center center;
background-color:#fbfbfb;
}
Using !important is usually a bad idea. Is this your entire css file or is there more? There may be another css style with higher priority that is overriding your attempts to set the background color here. I would suggest setting up a jsfiddle if you're still having trouble
If you want this code works, you have to remove the !important from your CSS code otherwise this rule will take priority on the :active state, and remember to change the colors in both states (actually you use #fbfbfb for both normal and active state).
I usually put 0 as value when i want to remove something in css. For example:
border: 0;
background: 0;
Is there any difference between 0 and none?
When used with composite styles like border and background, the values will correspond to different properties.
border: 0 will set border-width: 0 while border: none will set border-style: none.
background: 0 will set background-position: 0 while background: none will set background-image: none.
So, there is a difference. In the case of the border, the difference doesn't make any visual difference as both remove the border, but for the background it can make a difference if you also set any other background properties.