How to indent multiple lines

Posted on 2006-04-27
Last Modified: 2010-05-18
Is there a way via CSS to indent the table cell contents for multple lines. Using text-indent, padding-left, margin-left only indent the first line and as it wraps, it begins the new line at the extreme left - no padding.
Question by:Bl248
    LVL 14

    Expert Comment

    <p style="margin-left:20px;">This text will indent 20px, even wrapped lines. Try it, you'll like it.</p>

    margins & padding will apply to every wrapped line in a <p> (they apply to the paragraph as a whole), but not in a <span>

    to apply to an entire table cell and everything inside of it, you can use <td style="padding-left:20px;">

    Author Comment

    Thanks but I was looking for just a css style that could do this. I felt that I would need to change the HTML as well - and have a fix in place now. It would have been cleaner if I could have just used a CSS style as the template is used multiple times and I only wanted to change the CSS dynamically.
    LVL 14

    Accepted Solution

    ya. sorry.  in order for indents to be selective, changes to the code would be needed, as you need a way to specify what particular elements to indent.  

    be simple if you wanted every <p> indented,  td p {margin-left:20px;}

    but to indent the 1st and 3rd <p>'s in table 1, row 2, column 2, and the 2nd <img> in table 2, row 1, column 3,  while leaving everything else alone.. would require some changes to the code for those elements.

    Author Comment

    Thanks for confirming :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: Create Mobile App Prototypes with Adobe XD

    This is a project-based course: we go through all the steps of creating a prototype from start to finish, using all the tools and features currently available in Adobe XD. You can complete the course in less than a day, plus all project files and fonts are included.

    As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
    Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
    In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now