Search code examples
htmlcsspositioncss-positionfixed

position:fixed + float:right, where is the div?


I'm still studying HTML and CSS, perhaps this could be a silly mistake or not.

Look in my HTML, I have the #welcome div, but it disappeared when I set float:right.

http://jsfiddle.net/TkQaU/1/

(Chrome or Firefox)

Thanks!


Solution

  • Change float:right; to this:

    #topbar .content #welcome {
        position:absolute;
        right:100px;
    }
    

    http://jsfiddle.net/AlienWebguy/TkQaU/6/

    If you want to keep the float, you'll need to give it a margin-right of 100px to make up for the margin-left of the container:

    #topbar .content #welcome {
        float:right;
        margin-right:100px;
    }
    

    http://jsfiddle.net/AlienWebguy/TkQaU/4/