[英]My CSS3 doesn't work in my html page
Im trying to use some CSS3 code to rotate my text but I think it doesn't get recognized? 我试图使用一些CSS3代码来旋转我的文字,但我认为它不被识别?
CSS code: CSS代码:
.menu {
background-image:url('button.jpg');
cursor: pointer;
width: 61px;
height: 205px;
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-o-transform: rotate(270deg);
writing-mode: rl-tb;
}
HTML code: HTML代码:
<div id="menu-box">
<a class="menu" href="#" >HOME</a>
<a class="menu" href="#" >MYSELF</a>
<a class="menu" href="#" >PORTFOLIO</a>
<a class="menu" href="#" >CONTACT ME</a>
</div>
Im not sure what the problem is. 我不知道问题是什么。 I am missing something?
我错过了什么?
You can't transform inline elements; 您无法转换内联元素; change the display value of
.menu
to inline-block instead. 将
.menu
的显示值.menu
为内联块。
Simplified example: http://jsfiddle.net/vg73f/ 简化示例: http : //jsfiddle.net/vg73f/
The <a>
tags that your .menu
class apply to are inline
elements. .menu
类适用的<a>
标记是inline
元素。 They need to be block
level elements in order for the transform to apply. 它们需要是
block
级元素才能应用转换。
By adding display: block;
通过添加
display: block;
we can see that a transform applies correctly. 我们可以看到转换正确应用。
http://jsfiddle.net/RvrBM/ http://jsfiddle.net/RvrBM/
Alternatively you could use display: inline-block;
或者你可以使用
display: inline-block;
to allow the elements to rotate but stay in the inline arrangement. 允许元素旋转但保持内联排列。
http://jsfiddle.net/g5BRT/ http://jsfiddle.net/g5BRT/
Additionally, as Pavlo noted in the above comments, you are missing the unprefixed transform in your code. 另外,正如Pavlo在上面的注释中所指出的那样,您在代码中缺少未加前缀的转换。 It should look like this:
它应该如下所示:
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-o-transform: rotate(270deg);
transform: rotate(270deg);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.