I'm using panels and I want the panel title to be larger. So I read the bootstrap doc for panel and saw that I could use a h1.panel-title
inside a div.panel-header
. They even give you the markup. I pasted the markup in my page with h1 and it did not work.
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">Panel title</h1>
</div>
<div class="panel-body">
Panel content
</div>
</div>
I tried using the lead
class, but it adds a lot of undesirable whitespace underneath it. If I exclude the panel-title
class there is too much margin in the panel-header
. How do I make this work?
A panel in bootstrap is a bordered box with some padding around its content: Panels are created with the .panel class, and content inside the panel has a .panel-body class: Example. The .panel-default class is used to style the color of the panel.
Bootstrap 5 Header component Headers are compositions that extend standard navbar functionalities. They contain additional components like a jumbotron, sub-navbar, or image covers which serve as a containers for extra navigation elements - usually links, forms, or call-to-action buttons.
You can optionally add a heading box to the panel. To do this, nest another <div> with a class of .panel-heading inside the .panel outer container. You can use normal text or you can place the heading text inside a <h1> - <h6> element with the .panel-title class applied.
Bootstrap list groups also integrate seamlessly into panels. Bootstrap 4 is discontinuing wells, thumbnails, and panels in favor of cards, which will do nearly everything wells, thumbnails, and panels did, only better. Bootstrap 4 is in alpha release at the time of writing.
Thanks for the comment, @ShawnAnderson. You are absolutely right. All you need to do is remove the panel-title
class and the h1 will work.
<div class="panel panel-default">
<div class="panel-heading">
<h1>Panel title</h1>
</div>
<div class="panel-body">
Panel content
</div>
</div>
Fiddle: https://jsfiddle.net/DTcHh/29507/
This answer is preferred over my original answer since you do not have to override any bootstrap classes.
This small amount of css will do the trick if you include it after bootstrap.css.
h1.panel-title {
font-size: 36px;
}
h2.panel-title {
font-size: 30px;
}
h3.panel-title {
font-size: 24px;
}
h4.panel-title {
font-size: 18px
}
h5.panel-title {
font-size: 14px
}
h6.panel-title {
font-size: 10px;
}
This works, but I'd like to know if anyone has better ideas.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With