How to right align fixed position div inside a div

后端 未结 7 2100
庸人自扰
庸人自扰 2021-02-19 19:03

My code is like this.

some text here

CSS:



        
7条回答
  •  失恋的感觉
    2021-02-19 19:08

    You could use a container div:

    some text here

    Then use that to handle the float, and make its child position: fixed

    .outer {
        width:50%;
        height:600px;
        background-color:red;
        margin:0 auto;
        position: relative;
    }
    .floatcontainer {
        float: right;
    }
    .inner {
        border:1px solid white;
        position:fixed;
    }
    .floatcontainer, .inner{
        width: 50px;
    }
    

提交回复
热议问题