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

  • Home
  • SEARCH
  • 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 3241368
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:11:25+00:00 2026-05-17T18:11:25+00:00

Recently I was printing out some HTML source for a project I’ve been working

  • 0

Recently I was printing out some HTML source for a project I’ve been working on. I like to keep my markup tidy and readable. I noticed that in some places there are no line breaks on the outputted html and in some places there is excess indentation. For example take the following code, where I have preserved the indentation from the source file:

    <div id="sections">
    <ul>
    <?php if(!empty($details)) { ?>
        <li><a href="#details"><span>Details</span></a></li>

    <?php } if(!empty($address) { ?>
        <li><a href="#viewmap"><span>Location Map</span></a></li>

    <?php } if(!empty($reviews) { ?>
        <li><a href="#reviews"><span>Reviews (<?php echo $numrows; ?>)</span></a></li>

    <?php } if($email != null) { ?>
        <li><a href="#sendemail"><span>Send an Email</span></a></li>
    <?php } ?>
    </ul>

The generated HTML output is as follows:

    <div id="sections">
    <ul>
                <li><a href="#details"><span>Details</span></a></li>

                <li><a href="#viewmap"><span>Location Map</span></a></li>

                <li><a href="#sendemail"><span>Send an Email</span></a></li>
            </ul>
    </div>

Here we can see the DIV and UL tags have two tab indents from the left – this is fine. However the LI tags have 5 indents from the left – it should only be 3 if it goes according to my code. The end UL tag also has two extra indents.

Is this just the expected behaviour or can this be rectified somehow?

  • 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-05-17T18:11:25+00:00Added an answer on May 17, 2026 at 6:11 pm

    So? The output is matching your code perfectly. I don’t get, why there would be a problem?

    *tab**tab*<div id="sections">*newline*
    *tab**tab*<ul>*newline*
    *tab**tab*<?php if(!empty($details)) { ?>
    *tab**tab**tab*<li><a href="#details"><span>Details</span></a></li>*newline*
    *newline*
    *tab**tab*<?php } if(!empty($address) { ?>
    *tab**tab**tab*<li><a href="#viewmap"><span>Location Map</span></a></li>*newline*
    *newline*
    *tab**tab*<?php } if(!empty($reviews) { ?>
    *tab**tab**tab*<li><a href="#reviews"><span>Reviews (<?php echo $numrows; ?>)</span></a></li>*newline*
    *newline*
    *tab**tab*<?php } if($email != null) { ?>
    *tab**tab**tab*<li><a href="#sendemail"><span>Send an Email</span></a></li>*newline*
    *tab**tab*<?php } ?>
    *tab**tab*</ul>
    

    Delete the php code and you see that the numbers of tabs and newlines match.

    Oh and btw: The first ul should have a tab more, because it’s inside the div.

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

Sidebar

Related Questions

Recently I have been investigating the possibilities of caching in ASP.NET. I rolled my
Recently, I started changing some of our applications to support MS SQL Server as
Recently, I've been dealing with an error with accessing MAPI via the .NET framework
Recently our site has been deluged with the resurgence of the Asprox botnet SQL
Recently Jeff has posted regarding his trouble with database deadlocks related to reading. Multiversion
Recently I had to develop a SharePoint workflow, and I found the experience quite
Recently we got a new server at the office purely for testing purposes. It
Recently, I read an article entitled SATA vs. SCSI reliability . It mostly discusses
Recently I ran into this error in my web application: java.lang.OutOfMemoryError: PermGen space It's
Recently a friend and I were talking about securing stored procedure code in a

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.