Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome inserts random whitespace

I've a page whose styling gets messed up in Chrome (no problem for Safari and others). It seems that it inserts for a reason some strange whitespace in the HTML that ruins my layout at the top of the page and in other places. If I choose to see the source of my PHP page, what I see is:

<body><div id="header-outer">
<div id="header" class="container">
    <div class="row">
        <div id="site-logo" class="span5">
            <img src='logo.png' />
        </div> ... etc ...

(I've modified the PHP to have no space whatsoever between BODY and DIV). But when I open the developer tools what I see is:

<body>
    "" <- why?
    <div id="header-outer> etc. etc..

If I manually delete the "", the layout just goes fine. What is happening here? I'm puzzled.

EDIT: you can see the page at http://bit.ly/ZkZxVG EDIT: I've tried to disable all extensions, but with no effect on my issue.

Hint: I'm using bootstrap and JQuery. Could they mess with the code?

like image 713
Cranio Avatar asked Mar 08 '13 09:03

Cranio


People also ask

Why there is white space in my HTML page?

It's caused by margin collapsing phenomena. See related question. If you remove content of your main. css you will see that layout becomes "normal" (e.g. no white space on top), so normalize.

How do I get rid of white space in HTML?

Line Height Property: The CSS line-height-property can be used to set the height of the line, whose value is set to normal, by default. By setting the height of the container at 0%, the white space can be removed.

How do I remove blank space from a website?

Approach 1: We can remove space between any two tags by simply using margin-bottom property. The margin-bottom property sets the bottom margin of an element. We will assign a negative value to the margin-bottom of a particular tag to eliminate the extra space between the tags as shown.


1 Answers

It's really weird, you might have some undesired char within your file, try removing <body><div id="header-outer"> and rewrite it down.

Try encoding your file with utf8 No BOM too and see if it resolves the problem.

More infos about utf8 BOM here.

like image 155
soyuka Avatar answered Sep 28 '22 06:09

soyuka