简体   繁体   中英

Auto-Resizing Heading on Bootstrap 3 site

How I create the resizable <h1> element on the getboostrap.com homepage for Bootstrap 3: http://getbootstrap.com/getting-started/

I know I can use tools like fittext.js but theirs adjusts by using CSS media queries it seems.

From their CSS

@media (min-width: 768px) {
  .bs-masthead h1 {
    font-size: 100px;
  }
}

.bs-masthead h1 {
  font-size: 50px;
  line-height: 1;
  color: #fff;
}

You can put your <h1> tag in a Jumbotron . The default h1 font-size is 36px. You can use media queries to make it bigger:

@media screen and (min-width: 768px) {
  h1.resizable {
    font-size: 63px;
  }
}

You can add the resizable class to any h1 tag and it will make it bigger if the screen width is at minimum 768px.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM