2017-11-28 2 views
0

내 WordPress 웹 사이트에서 내 navbar를 회전하려고하지만 화면 중앙으로 이동하여 닫을 수 없습니다. ..Navbar 및 CSS 회전

enter image description here

이 깨끗한 알고 또는 더 나은 또 다른 옵션이 사용하고 있지만하지는 코드 CSS 스피입니다 :

내가 지금 무엇을 가지고의 스크린 샷입니다
nav.standard { 
position: fixed; 
-webkit-transform: rotate(90deg); 
-ms-transform: rotate(90deg); 
transform: rotate(90deg); 
} 

의견이 있으십니까?

감사합니다.

답변

0

다음과 같이 페이지의 측면에 붙이는 것이 좋습니다. 관련 비트의

라인 단위 고장 (아래 전체 라이브 데모) :

/* fix the bar */ 
position: fixed; 
/* since we're rotating, set its width to the screen height */ 
width: 100vh; 
bottom: 0; 
/* push our bar into the screen by its height (2em) */ 
right: 2em; 
line-height: 2em; 
/* rotate 90deg clockwise */ 
transform: rotate(90deg); 
/* use the bottom-right as rotation point */ 
transform-origin: 100% 100%; 

.nav { 
 
    list-style: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    text-align: center; 
 
    white-space: nowrap; 
 

 
    position: fixed; 
 
    width: 100vh; 
 
    bottom: 0; 
 
    right: 2em; 
 
    line-height: 2em; 
 
    transform: rotate(90deg); 
 
    transform-origin: 100% 100%; 
 
} 
 

 
.nav li { 
 
    display: inline-block; 
 
    margin: 0 1em; 
 
}
<ul class="nav"> 
 
    <li>Page 1</li> 
 
    <li>Page 2</li> 
 
    <li>Page 3</li> 
 
    <li>Page 4</li> 
 
</ul>

+0

안녕 존! 내가 당신의 코드를 시도하고 아무 것도 작동하지 않는 것 같습니다.보세요 : https://www.tontcho.es/project/prueba?preview_id=5396&preview=true – Tontcho

+0

@Tontcho 당신이 가지고있는 요소를 말할 수 없습니다. 내 CSS를 적용 해 보았습니다. –

+0

안녕하세요 @ 존, 당신이 내게 준 CSS 코드를 적용 :'nav { list-style : none; 여백 : 0; 패딩 : 0; 텍스트 정렬 : 가운데; white-space : nowrap; 위치 : 고정; 너비 : 100vh; 하단 : 0; 오른쪽 : 2em; 줄 높이 : 2em; 변형 : rotate (90deg); 변환 원점 : 100 % 100 %; } .nav li { 디스플레이 : 인라인 블록; 여백 : 0 1em; }' – Tontcho

0

당신은 transform: rotate(180deg);와 함께 writing-mode: vertical-lr;를 사용할 수 있습니다.

body { 
 
background-color: #eee; 
 
} 
 

 
nav.standard { 
 
position: absolute; 
 
left: 0; 
 
top: 0; 
 
bottom: 0; 
 
text-align: center; 
 
-webkit-writing-mode: vertical-lr; 
 
-moz-writing-mode: vertical-lr; 
 
-ms-writing-mode: vertical-lr; 
 
writing-mode: vertical-lr; 
 
transform: rotate(180deg); 
 
background-color: #FFF; 
 
} 
 

 
nav.standard a { 
 
    color: #333; 
 
    text-decoration: none; 
 
    display: inline-block; 
 
    padding: 0.8em 0.4em; 
 
    font-size: .75rem; 
 
}
<nav class="standard"> 
 
<a href="#">— Home</a> 
 
<a href="#">— About</a> 
 
<a href="#">— Portfolio</a> 
 
<a href="#">— Contact</a> 
 
</nav>

+0

안녕 다니엘! 도와 줘서 고맙다. 코드에 이상한 결과가있는 것 같습니다. https://www.dropbox.com/s/vgah67qvd9hjki0/Captura%20de%20pantalla%202017-11-28%20a%20las%2020.12.01.png?dl= 0 – Tontcho

+0

제공된 코드 스 니펫과 편집기에서 어떻게 작동하는지 살펴보십시오. 코드를 보지 않고도 다른 CSS가 라이브 사이트의 스 니펫을 방해하고 있다는 것을 알기가 어렵습니다. 이미지가 도움이되지 않는다. 나는 두렵다. –

+0

안녕 대니얼, 귀하의 발췌 문장에서 작동하지만 내 라이브 사이트에서는 그렇지 않습니다 ... 어쨌든 시도해 주셔서 감사합니다. Iam 아마추어에 대한 CSS와 물건과 방해 할 수없는 것을 찾을 수 없습니다 ... 나는 당신이 확인하고 싶습니다 : https://www.tontcho.es/project/prueba?preview_id=5396&preview=true – Tontcho