It is currently Wed May 07, 2025 8:45 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
Offline
 Post subject: How to indent text in HTML?
Post #1 Posted: Wed Feb 16, 2011 12:40 pm 
Lives with ko
User avatar

Posts: 248
Location: Arkansas, USA
Liked others: 193
Was liked: 21
Rank: KGS 8k
KGS: Azumi93
Online playing schedule: When I am in a mood for Go :D
Hello,

I am making a website now for my siblings, and it is almost ready, but one thing annoys me. I can't indent the text right!! I used tables and things like that but it never works. Could you guys give an advice what to do?
Thank you very much!

Stef

_________________
Stefany, web programmer

Top
 Profile  
 
Offline
 Post subject: Re: How to indent text in HTML?
Post #2 Posted: Wed Feb 16, 2011 12:57 pm 
Lives in gote
User avatar

Posts: 643
Location: Munich, Germany
Liked others: 115
Was liked: 102
Rank: KGS 3k
KGS: LiKao / Loki
What purpose do you to indent the text? The reason is very important, so you end up with a choice that reflects the meaning of your indent.

If it's code like text use the <pre> tag. It will result in a fixed space font and no linebreaks by default. So it's fit only for some purposes.

There are spaces like &nbsp; which won't be removed at the beginning of a line. But using them for indentation usually indicates a misunderstanding of what your real goal is. Can be used to indent code thought.

For most uses you don't want html to indent but css. Depending on what you need "margin-left" or "padding-left" could be right.

_________________
Sanity is for the weak.

Top
 Profile  
 
Offline
 Post subject: Re: How to indent text in HTML?
Post #3 Posted: Wed Feb 16, 2011 1:40 pm 
Gosei
User avatar

Posts: 1435
Location: California
Liked others: 53
Was liked: 171
Rank: Out of practice
GD Posts: 1104
KGS: fwiffo
As much as possible, you want the HTML to just describe the content of a page, and the CSS should describe what the content looks like.

For example your HTML might look like:

Code:
<p>All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy.</p>

<p>All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy.</p>

Which, by default will look something like:

Code:
All work and no play makes Jack a dull boy. All
work and no play makes Jack a dull boy. All work
and no play makes Jack a dull boy. All work and
no play makes Jack a dull boy. All work and no
play makes Jack a dull boy.

All work and no play makes Jack a dull boy. All
work and no play makes Jack a dull boy.

If you add some CSS to format the paragraphs:

Code:
p {
    text-indent: 5ex;
}

Code:
     All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy. All
work and no play makes Jack a dull boy. All work
and no play makes Jack a dull boy. All work and
no play makes Jack a dull boy.

     All work and no play makes Jack a dull boy.
All work and no play makes Jack a dull boy.

If you have one particular section you want indented differently, you could use some other tag to set it off. One that is good for block-quotes is the blockquote tag.

Code:
<p>All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy.</p>

<blockquote><p>The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.</p></blockquote>

<p>All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy.</p>

Which, by default, looks like:
Code:
All work and no play makes Jack a dull boy. All
work and no play makes Jack a dull boy. All work
and no play makes Jack a dull boy. All work and
no play makes Jack a dull boy. All work and no
play makes Jack a dull boy.

     The quick brown fox jumps over the lazy
     dog. The quick brown fox jumps over the
     lazy dog. The quick brown fox jumps over
     the lazy dog. The quick brown fox jumps
     over the lazy dog.

All work and no play makes Jack a dull boy. All
work and no play makes Jack a dull boy.

_________________
KGS 4 kyu - Game Archive - Keyboard Otaku


This post by fwiffo was liked by: deja
Top
 Profile  
 
Offline
 Post subject: Re: How to indent text in HTML?
Post #4 Posted: Thu Feb 17, 2011 9:42 am 
Lives with ko
User avatar

Posts: 248
Location: Arkansas, USA
Liked others: 193
Was liked: 21
Rank: KGS 8k
KGS: Azumi93
Online playing schedule: When I am in a mood for Go :D
Thank you very much guys, you are great. Any ideas why the blockquote tag doesn't work in Notepad ++ ? Thank you!

_________________
Stefany, web programmer

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group