Herbert
Herbert

Reputation: 580

how to left align the first inline element put in body element in google apps script

I am developing a web app by google apps script. I put inline element(span) at very first on body element. However, there is a gap between the very left edge of the screen and the left edge of the span element. And this gap is not slight.

I tried the same thing on js fiddle, but there is no as long gap as implementation by google apps script.

image the element in blue is span. the body is in red. the element in blue is span. the body is in red.

html

<body>
  <span>test</span>
</body>

styles can be seen on Chrome developer tool.

for span: enter image description here

for body: enter image description here

I want to left align the span element on body. Please let me know the solution. Thanks in advance.

Upvotes: 2

Views: 173

Answers (2)

Herbert
Herbert

Reputation: 580

I found the cause of the problem. That is, there are full-width spaces above the span element. I had full-width spaces in . I removed all the spaces from head. The gap on the left of the span disappeared.

I couldn't tell if there were spaces or not because the spaces can't be seen. I thought that all the spaces were put with half-width spaces which don't make any spaces on the html.

before:

<!DOCTYPE html>
<html>
  <head>
     <base target="_top">
    <?!= include('css'); ?>
  </head>
  <body>
    <span>test</span>
  </body>
</html>

There is one full-width space just before the <base target="_top">.

enter image description here

after:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <?!= include('css'); ?>
  </head>
  <body>
    <span>test</span>
  </body>
</html>

enter image description here

Upvotes: 1

Sifat Haque
Sifat Haque

Reputation: 6057

You can globally set margin and padding to 0 to removes all default margin and padding for every object on the page

* {
  margin: 0;
  padding:0;
}

Upvotes: 0

Related Questions