The HTML inline-styling property, known as the text-indent property, indents each paragraph of text just as you would indent the first line of a paragraph when writing a paper.
The code editor shows how to create text-indent in pixels (px):
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Text Indent HTML</title> </head> <body> <p style="text-indent: 25px;"> Baseball ipsum dolor sit amet passed ball outs, sweep stretch bleeder triple play. Left fielder count fair swing cork balk ball. Full count southpaw reliever lineup crooked number fastball second base. Perfect game outfielder rally force dodgers right fielder dead ball era right field. Pickoff world series peanuts batting average cup of coffee foul inside robbed. Bleeder club appeal first base sidearm mustard steal line drive inning. </p> <p style="text-indent: 25px;"> Sidearm bullpen base on balls national pastime losses reliever umpire pull dribbler. Manager 4-bagger tag national pastime pennant good eye relief pitcher. Save on-base percentage fan ejection baseball card skipper reliever strikeout bench. On-base percentage fenway contact win warning track, ball rhubarb center field. Starting pitcher hey batter out cellar cardinals basehit double switch. Play hey batter tigers sidearm in the hole shortstop no decision. </p> <p style="text-indent: 25px;"> Off-speed petey pinch hitter astroturf walk off no decision count full count wrigley. Hack cheese helmet tossed gap run red sox. Fall classic in the hole ejection rotation rally center field shift. Manager pickoff knuckleball assist pinch runner pitchout stretch. Steal hardball extra innings alley rubber off-speed flyout third base. Baseline butcher boy umpire left field hitter, catcher win right field can of corn. </p> </body>
This example shows you an absolute length unit called pixels (px). You can also express the indent in relative/responsive length units like em, rem, and then % of the overall element’s/paragraph’s width.
This property is the same as the CSS property of the same name. The only difference between this and the CSS version is where the selector rule is located. The CSS text-indent property is located with the other CSS rules in the style tag in the HTML head or CSS external stylesheet. The HTML equivalent is written as an inline style in your actual markup.
- Career Karma matches you with top tech bootcamps
- Get exclusive scholarships and prep courses
About us: Career Karma is a platform designed to help job seekers find, research, and connect with job training programs to advance their careers. Learn about the CK publication.