There were numerous errors in your code, you were having one major error in your code, that was selector for ID was being confused with the selector of class.
div#username { }
was to be used and you were not using the hash sign which would have accessed the element with that ID. Secondly, using
50px
width isnot enough, use it to be
200px
atleast.
Second thing was that you were not using the float right property to align the elements on the right side, I have used the following code for the
nagivation
and it floated the element to the right,
.navigation {
float: right;
}
One more thing is that why are you trying to select each element and appending the div to it? When you don't have any other element with the very same class or id?
Instead of using the following code
div.navigation{
float: right;
width: 70%;
}
..this code is enough,
#navigation{
float: right;
width: 70%;
}
You need to be doing this, if you're having multiple elements with same classname.
The list would have been better if you used something like this, because Unordered List item is a better navigation control, rather than using div elements.
<ul>
<li>First Item</li>
<li>Second Item</li>
</ul>
I would definitely forward you to the MDN (Mozilla Developer Network) to learn some new stuff about HTML and CSS. You can learn more resources there and you can find some articles about aligning the content, to right and left and so on.
Somehow, here is the fiddle that I have created for you:
[
^], have a look at it, watch it, edit it and see what happens.
Need something else? Feel free to comment and reply!