글꼴 멋진 아이콘을 정적으로 회전
글꼴 멋진 아이콘을 45 도씩 정적으로 회전하고 싶습니다. 사이트에 다음과 같이 나와 있습니다.
아이콘을 임의로 회전하고 뒤집으려면 fa-rotate- * 및 fa-flip- * 클래스를 사용하십시오.
그러나
<i class="fa fa-link fa-rotate-45" style="font-size:1.5em"></i>
교체 반면, 작동하지 않습니다 fa-rotate-45
와 함께 fa-rotate-90
한다. 이것은 실제로 그들이 임의로 회전 할 수 없다는 것을 의미합니까?
FontAwesome 5 이전 :
표준 선언에는 .fa-rotate-90
, .fa-rotate-180
및 만 포함 .fa-rotate-270
됩니다. 그러나 다음과 같이 쉽게 만들 수 있습니다.
.fa-rotate-45 {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
FontAwesome 5 :
소위 "Power Transforms"를 사용할 수 있습니다. 예:
<i class="fas fa-snowman" data-fa-transform="rotate-90"></i>
<i class="fas fa-snowman" data-fa-transform="rotate-180"></i>
<i class="fas fa-snowman" data-fa-transform="rotate-270"></i>
<i class="fas fa-snowman" data-fa-transform="rotate-30"></i>
<i class="fas fa-snowman" data-fa-transform="rotate--30"></i>
data-fa-transform
값 rotate-
과 원하는 회전 각도를 사용 하여 속성 을 추가해야합니다 .
출처 : https://fontawesome.com/how-to-use/on-the-web/styling/power-transforms
다른 누군가 가이 질문을 우연히 발견하고 여기에서 원하는 경우 내가 사용하는 SASS 믹스 인입니다.
@mixin rotate($deg: 90){
$sDeg: #{$deg}deg;
-webkit-transform: rotate($sDeg);
-moz-transform: rotate($sDeg);
-ms-transform: rotate($sDeg);
-o-transform: rotate($sDeg);
transform: rotate($sDeg);
}
새로운 Font-Awesome v5 에는 Power Transform이 있습니다.
아이콘에 속성 data-fa-transform
을 추가하여 모든 아이콘을 회전 할 수 있습니다.
<i class="fas fa-magic" data-fa-transform="rotate-45"></i>
여기 바이올린이 있습니다
자세한 내용은 다음을 확인하십시오. Font-Awesome5 Power Tranforms
45도 회전하려면 CSS transform 속성을 사용할 수 있습니다.
.fa-rotate-45 {
-ms-transform:rotate(45deg); /* Internet Explorer 9 */
-webkit-transform:rotate(45deg); /* Chrome, Safari, Opera */
transform:rotate(45deg); /* Standard syntax */
}
당신이 사용하는 경우 더 적은을 직접 다음과 믹스 인을 사용할 수 있습니다 :
.@{fa-css-prefix}-rotate-90 { .fa-icon-rotate(90deg, 1); }
참고 URL : https://stackoverflow.com/questions/22747193/statically-rotate-font-awesome-icons
'developer tip' 카테고리의 다른 글
window.location.href와 top.location.href의 차이점 (0) | 2020.09.14 |
---|---|
숫자의 정수 및 소수 부분을 얻는 방법? (0) | 2020.09.13 |
Maven 3.3.1 ECLIPSE : -Dmaven.multiModuleProjectDirectory 시스템 속성이 설정되지 않았습니다. (0) | 2020.09.13 |
인덱스 자리 표시 자 대신 명명 된 입력 매개 변수를 허용 할 수있는 "String.Format"이 있습니까? (0) | 2020.09.13 |
bash에서 for 루프를 작성하는 방법 (0) | 2020.09.13 |