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

Horizontal justified nav gets ugly when text wraps #15906

Closed
fabiocarneiro opened this issue Feb 24, 2015 · 17 comments
Closed

Horizontal justified nav gets ugly when text wraps #15906

fabiocarneiro opened this issue Feb 24, 2015 · 17 comments

Comments

@fabiocarneiro
Copy link

http://jsbin.com/woveliqaga/1/

@twbs-lmvtfy
Copy link

Hi @fabiocarneiro!

You appear to have posted a live example (http://jsbin.com/woveliqaga/1/edit), which is always a good first step. However, according to the HTML5 validator, your example has some validation errors, which might potentially be causing your issue:

  • line 1, column 16: Start tag seen without seeing a doctype first. Expected <!DOCTYPE html>.
  • line 86, column 111: Stray start tag object.

You'll need to fix these errors and post a revised example before we can proceed further.
Thanks!

(Please note that this is a fully automated comment.)

@fabiocarneiro
Copy link
Author

@twbs-lmvtfy
Copy link

Hi @fabiocarneiro!

You appear to have posted a live example (http://jsbin.com/fabifukine/1/edit), which is always a good first step. However, according to the HTML5 validator, your example has some validation errors, which might potentially be causing your issue:

  • line 87, column 111: Stray start tag object.

You'll need to fix these errors and post a revised example before we can proceed further.
Thanks!

(Please note that this is a fully automated comment.)

@fabiocarneiro
Copy link
Author

@kkirsche
Copy link
Contributor

This appears to be a copy of the example which uses the nav-justified class from the example. Looking through the source shows that .nav-justified specifically sets a max-height. I would say since this example requires custom code and is not Bootstrap core, this wouldn't be something that would be supported in the issue tracker.

With that said, does this occur with the navbar versions included in the base Bootstrap without any need for custom code? If so, then I would agree there is an issue that needs to be addressed.

@cvrebert cvrebert added the css label Feb 24, 2015
@cvrebert cvrebert changed the title Nav gets ugly with different sized buttons. Horizontal justified nav gets ugly when text wraps Feb 24, 2015
@fabiocarneiro
Copy link
Author

I'm not sure. I just copied exactly same html, removed some of the buttons and increased the text size.
This is a custom example, but the justified navs are part of the core, and it will happen even in the example from the docs.

I'm not sure if that is even possible, but it should be nice to the other buttons to follow the same height of the bigger one.

@kkirsche
Copy link
Contributor

I assumed it wasn't core from the "Justified navbar nav links are currently not supported." found here

@fabiocarneiro
Copy link
Author

@kkirsche that's navbar, another component. The one i'm complaining about is "Navs".

@mdo
Copy link
Member

mdo commented Feb 25, 2015

Truncate the text using one of our utility classes or don't include so much text :).

@mdo mdo closed this as completed Feb 25, 2015
@fabiocarneiro
Copy link
Author

@mdo, that's not a good option. in fact that nav thing only work with "one line" text buttons, anything higher than 1 line will break things. I'm not trying to use a ridiculous amount of text, but in my use case it must have two lines.

@cvrebert
Copy link
Collaborator

@mdo At the least, that restriction should be documented, IMO.

@kkirsche
Copy link
Contributor

@cvrebert where in the docs would this be documented though?

The justified nav pills itself doesn't "break" due to multi-line. A justified navbar styled version which is considered a custom component per the wording from the examples page breaks.

As I see it, this isn't something that should be included in the main docs as it doesn't really affect the component itself, but rather an implementation of it. It could potentially though be documented in the source code of the example itself though. Thoughts?

kkirsche added a commit to kkirsche/bootstrap that referenced this issue Feb 25, 2015
Document in the source code that the justified nav is meant for single line list items only. This should help prevent Issues like twbs#15906 in the future.
@fabiocarneiro
Copy link
Author

@kkirsche I already told you that this is not happening only in the custom example layout, but apparently you didn't believe.

http://jsbin.com/jokejajeza/1/#nav

Take a look in the "justified" section.

And again i repeat, we are talking about navs here, not navbar. That's another component. I noticed you referenced this in a navbar issue.

@twbs-lmvtfy
Copy link

Hi @fabiocarneiro!

You appear to have posted a live example (http://jsbin.com/jokejajeza/1/edit), which is always a good first step. However, according to the HTML5 validator, your example has some validation errors, which might potentially be causing your issue:

  • line 3433, column 81: Element img is missing required attribute src.
  • line 3438, column 81: Element img is missing required attribute src.
  • line 3443, column 81: Element img is missing required attribute src.
  • line 3448, column 81: Element img is missing required attribute src.
  • line 3468, column 81: Element img is missing required attribute src.
  • line 3478, column 81: Element img is missing required attribute src.
  • line 3488, column 81: Element img is missing required attribute src.
  • line 3756, column 149: Attribute autocomplete not allowed on element button at this point.
  • line 3803, column 95: Element img is missing required attribute src.
  • line 3814, column 95: Element img is missing required attribute src.
  • line 3823, column 99: Element img is missing required attribute src.
  • line 3840, column 95: Element img is missing required attribute src.
  • line 3847, column 95: Element img is missing required attribute src.
  • line 3856, column 95: Element img is missing required attribute src.
  • line 3880, column 95: Element img is missing required attribute src.
  • line 3892, column 95: Element img is missing required attribute src.
  • line 3904, column 95: Element img is missing required attribute src.
  • line 3933, column 97: Element img is missing required attribute src.
  • line 3943, column 101: Element img is missing required attribute src.
  • line 3953, column 105: Element img is missing required attribute src.
  • line 3967, column 101: Element img is missing required attribute src.

You'll need to fix these errors and post a revised example before we can proceed further.
Thanks!

(Please note that this is a fully automated comment.)

@mdo
Copy link
Member

mdo commented Feb 25, 2015

If there's too much content within something, I don't know what we could document anywhere—in the example or the main docs—other than what I suggested above. Without sounding too much like a jackass though, that feels like common sense to me given the nature of the component.

The justified nav is equal-width nav links. If one of those nav link's content is far too long, it will wrap. Preventing that wrapping on the outset feels unnecessary for most use cases.

mdo added a commit that referenced this issue Feb 25, 2015
Add source code documentation of justified navbar for #15906
@kkirsche
Copy link
Contributor

@fabiocarneiro I apologize if you feel my intention was to ignore what you had said. I based my comment on the JSBin provided which I incorrectly assumed demonstrated the problem (when one item in nav-justified tabs or background colored pills) and it's scope (tabs and background colored pills. I didn't see a real issue with the pills themselves personally but I can understand it).

With that said, the easy 'hack' fix should be to ensure all of your nav links are the same length using code such as <br>&nbsp; which should ensure they are all two lines worth of content.

This addresses the height issue caused by wrapping the text and ensures it is all equal throughout the component. Yes, this is not a perfect solution and yes there are still issues with how it looks, but it does fix the underlying problem of having multiple different sized nav items.

I apologize though @fabiocarneiro if you felt my comments were meant to ignore other cases or that I was referring to a navbar component. In regards to my verbiage of "navbar" — I feel the original JSBin provided is a nav item which has been styled to look like a pseudo-navbar and navbar in my opinion accurately describes how it's being used in that example. The standard nav items usually use button link styles which are not solid like that.

Nonetheless, didn't mean to ignore what was said, I just made an incorrect assumption based on the JSBin originally provided and what I had seen. Sorry! 😃

@fabiocarneiro
Copy link
Author

@kkirsche Sorry man, i didn't mean to be rude.

the <br>&nbsp; would fix it, but the text wouldn't be vertically centered. I'm not an css expert so i'm not sure that is even possible, but it would be nice to have all the nav buttons the same height...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants