'box-shadow-color'속성이 있습니까?
다음 CSS가 있습니다.
box-shadow: inset 0px 0px 2px #a00;
이제 페이지 색상을 '스킨 가능'하게하기 위해 해당 색상을 추출하려고합니다. 이 작업을 수행하는 방법이 있습니까? 색상을 제거한 다음 동일한 키를 다시 사용하면 나중에 원래 규칙을 덮어 씁니다.
box-shadow-color
적어도 Google은 아무것도 켜지지 않는 것 같습니다 .
아니:
http://www.w3.org/TR/css3-background/#the-box-shadow
계산 된 스타일 목록을 확인하여 Chrome 및 Firefox에서이를 확인할 수 있습니다. 속기 방법 (예 :)이있는 다른 속성 border-radius
에는 사양에 정의 된 변형이 있습니다.
대부분의 "long-hand"CSS 속성이 누락 된 것처럼 CSS 변수 는이 문제를 해결할 수 있습니다.
#el {
--box-shadow-color: palegoldenrod;
box-shadow: 1px 2px 3px var(--box-shadow-color);
}
#el:hover {
--box-shadow-color: goldenrod;
}
실제로…있다! 일종의. box-shadow
기본적으로 color
처럼 border
.
http://dev.w3.org/.../#the-box-shadow 에 따르면
색상은 그림자의 색상입니다. 색상이 없으면 '색상'속성에서 사용 된 색상을 가져옵니다.
실제로 color
속성 을 변경하고 box-shadow
색상을 남기지 않아야합니다.
box-shadow: 1px 2px 3px;
color: #a00;
지원하다
- 사파리 6+
- Chrome 20 이상 (적어도)
- Firefox 13 이상 (적어도)
- IE9 + (IE8은 전혀 지원하지 않습니다
box-shadow
)
데모
div {
box-shadow: 0 0 50px;
transition: 0.3s color;
}
.green {
color: green;
}
.red {
color: red;
}
div:hover {
color: yellow;
}
/*demo style*/
body {
text-align: center;
}
div {
display: inline-block;
background: white;
height: 100px;
width: 100px;
margin: 30px;
border-radius: 50%;
}
<div class="green"></div>
<div class="red"></div>
아래 주석에 언급 된 버그가 수정되었습니다 :)
CSS 프리 프로세서를 사용하여 스키닝을 수행 할 수 있습니다. Sass 를 사용하면 이와 비슷한 것을 할 수 있습니다.
_theme1.scss :
$theme-primary-color: #a00;
$theme-secondary-color: #d00;
// etc.
_theme2.scss :
$theme-primary-color: #666;
$theme-secondary-color: #ccc;
// etc.
styles.scss :
// import whichever theme you want to use
@import 'theme2';
-webkit-box-shadow: inset 0px 0px 2px $theme-primary-color;
-moz-box-shadow: inset 0px 0px 2px $theme-primary-color;
사이트 전체 주제가 아니라 클래스 기반 주제가 필요한 경우 다음을 수행 할 수 있습니다. http://codepen.io/jjenzz/pen/EaAzo
CSS 변수 로이 작업을 수행 할 수 있습니다
.box-shadow {
--box-shadow-color: #000; /* Declaring the variable */
width: 30px;
height: 30px;
box-shadow: 1px 1px 25px var(--box-shadow-color); /* Calling the variable */
}
.box-shadow:hover {
--box-shadow-color: #ff0000; /* Changing the value of the variable */
}
A quick and copy/paste you can use for Chrome and Firefox would be: (change the stuff after the # to change the color)
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-khtml-border-radius: 10px;
-border-radius: 10px;
-moz-box-shadow: 0 0 15px 5px #666;
-webkit-box-shadow: 0 0 15px 05px #666;
Matt Roberts' answer is correct for webkit browsers (safari, chrome, etc), but I thought someone out there might want a quick answer rather than be told to learn to program to make some shadows.
Yes there is a way
box-shadow 0 0 17px 13px rgba(30,140,255,0.80) inset
Maybe this is new (I am also pretty crap at css3), but I have a page that uses exactly what you suggest:
-moz-box-shadow: 10px 10px 5px #384e69;
-webkit-box-shadow: 10px 10px 5px #384e69;
box-shadow: 10px 10px 5px #384e69;}
.. and it works fine for me (in Chrome at least).
참고URL : https://stackoverflow.com/questions/3012899/is-there-a-box-shadow-color-property
'IT' 카테고리의 다른 글
cout은 std의 회원이 아닙니다 (0) | 2020.05.24 |
---|---|
이동 평균 계산 (0) | 2020.05.23 |
OS X Lion에서 터미널이 ~ / .bashrc를로드하지 않는 문제를 해결하는 방법 (0) | 2020.05.23 |
키를 포함한 PHP의 array_map (0) | 2020.05.23 |
문자열에서 주어진 부분 문자열의 발생 횟수 (0) | 2020.05.23 |