Getting the button into the top right corner inside the div box

前端 未结 2 942
广开言路
广开言路 2021-01-01 10:56

I can\'t figure out how to get the [X] button into the top right corner of my custom css box.

Here\'s the result so far:

相关标签:
2条回答
  • 2021-01-01 11:10

    Just add position:absolute; top:0; right:0; to the CSS for your button.

     #button {
         line-height: 12px;
         width: 18px;
         font-size: 8pt;
         font-family: tahoma;
         margin-top: 1px;
         margin-right: 2px;
         position:absolute;
         top:0;
         right:0;
     }
    

    jsFiddle example

    0 讨论(0)
  • 2021-01-01 11:34
    #button {
        line-height: 12px;
        width: 18px;
        font-size: 8pt;
        font-family: tahoma;
        margin-top: 1px;
        margin-right: 2px;
        position: absolute;
        top: 0;
        right: 0;
    }
    
    0 讨论(0)
提交回复
热议问题