Code has been added to clipboard!

Customizing CSS Tabs

Reading time 1 min
Published Aug 8, 2017
Updated Sep 27, 2019

Setting the width for CSS tabs

By using the CSS tab-size property, you can define a custom size for the tab character:

Example
pre {
    tab-size: 24;
}

Note: due to the whitespace collapse principle, CSS tabs or multiple spaces can only be displayed in preformatted text.

Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid certificates of completion
Coursera
Pros
  • Professional service
  • Flexible timetables
  • A variety of features to choose from
Main Features
  • Professional certificates of completion
  • University-level courses
  • Multiple Online degree programs
Datacamp
Pros
  • Great user experience
  • Offers quality content
  • Very transparent with their pricing
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable

Syntax for customizing CSS tabs

The CSS tab-size property only takes one value that define the width of the tab character:

tab-size: width;

You can specify it in two ways:

  • Length units can be used to define exact width
  • A unitless number defines how many spaces the tab will be equal to in width

Browser support

Browser image
Chrome
21+
Browser image
Edge
-
Browser image
Firefox
4+
Browser image
IE
-
Browser image
Opera
15+
Browser image
Safari
6.1+

Mobile browser support

Browser image
Chrome
25+
Browser image
Firefox
4+
Browser image
Opera
14+
Browser image
Safari
7.1+

Latest Udacity Coupon Found:

Verified STAFF PICK

75% OFF COURSES

Udacity Black Friday Offer

The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!

Expiration date: 25/01/2021
3176 People Used
Only 97 Left
Rating
5.0