Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative margin on '.navbar-right:last-child' in Navbar is a miscalculation #13325

Closed
aahan opened this issue Apr 11, 2014 · 3 comments · Fixed by #13464 or #14051
Closed

Negative margin on '.navbar-right:last-child' in Navbar is a miscalculation #13325

aahan opened this issue Apr 11, 2014 · 3 comments · Fixed by #13464 or #14051

Comments

@aahan
Copy link

aahan commented Apr 11, 2014

Issue in: Navbar component

.navbar-nav.navbar-right:last-child {
  margin-right: -15px;
}

That's the CSS style applied on the right-floating menu items' container. It does its intended job only as long as there's only one <element class=" ... navbar-right"> in the Navbar. Add another and it messes the spacing of the last container ("last" not in HTML but in the order of appearance in browser, considering it's float: right;).

The Dashboard example template has the necessary items to reproduce the issue. Take a look at the snapshots, they should be self-explanatory.

Screenshot (1)
Screenshot (2)
Screenshot (3)

I am not saying margin-right: -15px; is wrong. It's needed, but doesn't suit all cases like I clearly explained. Manually adding a class like .last-child on the element itself is probably the way to go, but what do I know!

@cvrebert cvrebert added the css label Apr 11, 2014
@RWOverdijk
Copy link
Contributor

+1. I'm using it as a toolbar, where I don't want the button to stick to the right.I can opt-out by setting the margin to 0 myself, but I think bootstrap is all about opt-in.

Sticky situation

@jerem
Copy link

jerem commented Apr 28, 2014

Same issue here.

What about targeting .navbar-right:first instead?

The first navbar-right element should be the last one in the order of appearance in the browser.

@NickColley
Copy link
Contributor

I've created a PR to fix this, if anyone has time to test it that'd be ace so I can make any amends needed. #13464

@lee36656
Copy link

NAVER - http://www.naver.com/

lee36656@naver.com 님께 보내신 메일 <Re: [bootstrap] Negative margin on '.navbar-right:last-child' in Navbar is a miscalculation (#13325)> 이 다음과 같은 이유로 전송 실패했습니다.


받는 사람이 회원님의 메일을 수신차단 하였습니다.


@cvrebert cvrebert added this to the v3.2.1 milestone Jun 9, 2014
@mdo mdo closed this as completed in #13464 Jul 6, 2014
mdo added a commit that referenced this issue Jul 6, 2014
loic added a commit to loic/bootstrap that referenced this issue Jul 7, 2014
loic added a commit to loic/bootstrap that referenced this issue Jul 7, 2014
mdo added a commit that referenced this issue Jul 7, 2014
Address margins on .navbar-right to fix #13325 #13464.
stempler pushed a commit to stempler/bootstrap that referenced this issue Nov 4, 2014
…r-right-first

Changed last-child to first-child to fix twbs#13325
stempler pushed a commit to stempler/bootstrap that referenced this issue Nov 4, 2014
stempler pushed a commit to stempler/bootstrap that referenced this issue Nov 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants