css - 如何向左扩展div?

标签 css html expand

如何展开离开这个div? 它唯一的正确扩展,我尝试了一切,但它仍然无法正常工作 请帮忙

<div id="menu"></div>

#menu
{
float:right;    
width:33px;
height:33px;
overflow:hidden;
background:#0F0;
position:absolute;
z-index:3;  
left:49%;
-moz-transition-property: width; /* Firefox 4 */
-moz-transition-duration: 1s; /* Firefox 4 */
-webkit-transition-property: width; /* Safari and Chrome */
-webkit-transition-duration: 1s; /* Safari and Chrome */
-o-transition-property: width; /* Opera */
-o-transition-duration: 1s; /* Opera */
}       

#menu:hover
{
width:180px;
}

最佳答案

试试这个:

<style>
    #menu {
        width:33px;
        height:33px;
        position:absolute;
        background:#0F0;
        overflow:hidden;
        z-index:3;
        transition: width 1s;
        -moz-transition: width 1s;
        -webkit-transition: width 1s;
        -o-transition: width 1s;
        right:49%;
    }
    #menu:hover {
        width:180px;
    }
</style>
<div id="menu"></div>

关于css - 如何向左扩展div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15022310/

相关文章:

css - Bootstrap : How do I align the button correctly?

html - 溢出 y 正在影响溢出 x

SQL/Presto 将列表列扩展为多行

javascript - 伪 :after class 的切换类

html - 使用 flexbox 调整图像和标题的大小

javascript - 如何让导航栏在点击链接时消失

javascript - 使用 JavaScript 中的正则表达式从 anchor 标记字符串中提取内部文本

jquery-Flot 使用带有 % 宽度和高度的 <Div>

css - 动态加载内容时增加 div 的高度