问题描述:

I like to make my navigation bar and header all the same, but I can't get the navigation bar to align properly. Using float: right doesn't work, as it appears to take it out of the container (if that makes sense)

My code is here: https://jsfiddle.net/AVY7T/228/

网友答案:

Did you add float: right to your element? As you said, floating will make the parent element ignore the element height, which places the element outside the parent. Adding overflow: hidden; to the parent element, in this case the header class, will solve the problem.

Updated JSFiddle:

https://jsfiddle.net/AVY7T/231/

Placing both elements on the same row:

https://jsfiddle.net/AVY7T/232/

相关阅读:
Top