The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Extra indent when viewing source code in browser

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #41845

    When I view my source code in a browser (i.e., Chrome and Opera), I’m getting extra indents in random spots of my code. Although I’ve formatted the code to my liking in my text editors of choice, both Chrome and Opera don’t seem to be fully honoring this formatting. I don’t get this issue when I view my code in FF, however.

    My initial inclination was that this issue was stemming from the text editor in which I wrote and formatted the code. The text editor I used initially was Dreamweaver. When I copied my code to Notepad++, however, and viewed my source code in both of the aforementioned browsers, I still had the same issue.

    Has anyone dealt with this issue before and if so how did you solve it? Thanks for any help or suggestions.


    Just curious, why do you care about the minor indentation problem?

    I’ve had the same result happen before due to PHP but nothing that I really cared to worry about.


    If you are including files via PHP, you’re definitely going to get odd indentation.


    In Notepad++, try to paste it, remove all the white space and re-indent the code.


    You may be seeing tabs and not spaces. Most text editors have a setting to show tabs as X-number of spaces. For instance, let’s say your text editor is set to show a tab as 2 spaces while a browser source viewer would render a tab as 4 spaces.This is where the inconsistency would arise. Also, most text editors have a setting to automatically convert tabs to spaces on save, which would eliminate the inconsistency (if that’s what’s actually causing it).

    As I haven’t seen your site, this is just speculation.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.