Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8174295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:24:58+00:00 2026-06-06T22:24:58+00:00

This one’s a head scratcher. I’ve created a commented jsFiddle to demonstrate the phenomenon

  • 0

This one’s a head scratcher.

I’ve created a commented jsFiddle to demonstrate the phenomenon I recently encountered while using Twitter’s Bootstrap framework to create some dropdown buttons.

http://jsfiddle.net/jackwanders/WKvPv/

Basically, when using an HTML5, HTML 4 Strict or XHTML Strict DOCTYPE, the button renders as designed. However, when using an HTML4 or XHTML Transitional DOCTYPE, the caret button renders with a shorter height. Here’s the relevant CSS from Bootstrap for the <span class="caret"> (i’ve removed styles that don’t matter, like colors and gradients):

.caret {
  display: inline-block;
  width: 0;
  height: 0;
  vertical-align: top;
  border-top: 4px solid #000000;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  content: "";
}

.btn .caret {
  margin-top: 7px;
  margin-left: 0;
}

.btn {
  display: inline-block;
  *display: inline;
  padding: 4px 10px 4px;
  margin-bottom: 0;
  *margin-left: .3em;
  line-height: 18px;
  *line-height: 20px;
  text-align: center;
  vertical-align: middle;
}

Why does the DOCTYPE affect the height of the button? If line-height is set to 18px, why would the height be less than 18px?

PS – Yes, I’m aware that Bootstrap requires HTML5, but I’d imagine that’s with respect to the HTML5 features utilized, not how the DOCTYPE renders CSS styles

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:24:59+00:00Added an answer on June 6, 2026 at 10:24 pm

    While writing this question and the related jsFiddle demo, I wound up doing some more digging and found out what’s happening. Rather than scrap the question, I figured I may as well post it with this answer.

    What I’ve gathered from inspecting the elements in Chrome after switching DOCTYPES is this:

    • .btn has no height specified, only line-height: 18px and padding: 4px 10px
    • in HTML5, the final height of the caret-only button is 18px, same as the defined line-height
    • in a Transitional DOCTYPE, the height of the caret-only button is 11px, same as the outerHeight() of the caret (border-top + margin-top), but less than the line-height of the button.

    So, I can only assume that Strict (and HTML5) DOCTYPEs enforce line-height as some kind of min-height; even if there is no text in the element, it applies line-height … whereas Transitional DOCTYPES do not.

    When I add some text to the caret-only button (&nbsp; for example), then line-height kicks in on Transitional DOCTYPEs and the button renders at the full height.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This one is a real head scratcher for me... var matches = Regex.Matches(<p>test something<script
This one is bit tricky , I created jsfiddle here http://jsfiddle.net/WXmcL/10/ to kinda replicate
This one has bugged me for a while now. Recently when revisiting some code
This one has been stumping me for a while. But I'm no expert. This
This one has me scratching my head, so I'm hoping a second pair of
This one has got me stumped. I am currently rendering a form using ASP
This one's tough to explain, so I'll try to show what I'm after using
This one has been bugging me for a while now, but I never seem
This one is doing my head in... I need to retrieve data from Oracle
This one has been bugging me for a while now. Is there a way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.