0

I have a tabbed panel with 6 tabs. I'd like to set the CSS so that the width of each tab changes to auto-fit the text in that tab, so tabs with long sentences are wider, & tabs with shorter sentences are slimmer. I'd also like the maximum width of the panel to be 900px.

This is my CSS so far:

#TabbedPanels2 .TabbedPanelsContentGroup {
margin-left:auto;
margin-right:auto;
width:70%;
margin-top:105px;
max-width:900px;
}

The issue right now is that all 6 of the tabs always stay at 900px, instead of auto-adjusting down to fit the text. You can see the results here: www.shellshockeddoc.com Specifically with the tabs for "Watch" & "Screenings"

Thanks a lot in advance!

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304

3 Answers3

0

You should use width: 100%; max-width: 900px; and also define min-width: 0px; as you are having problem for this.

Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231
0

display: inline-block; will cause an element to span the width of its content rather than the width of its container. If you add display: inline-block; to both .TabbedPanelsContent and .TabbedPanelsContentGroup and then add text-align: center; to .TabbedPanels you'll get (centered) tab boxes of varying widths depending on the width of their content.

essmahr
  • 676
  • 4
  • 15
0

remove width of tab class and add margin:0 auto;padding:3px