Basic formatting HTML question

F

Fred

Greetings friends and neighbors!

I'm fairly new to HTML and so a pretty basic question....

On a page with all text, when the lines wrap at the right, some words butt
right up to the very edge of the screen. This makes it look like the text
runs off the screen, even though it doesn't.

I think I have seen code that makes the text take up only a certain amount
of the screen -- say 95%. Can someone pls give me a hand on this?

Thanks much!

Fred
 
M

Mark Parnell

Deciding to do something for the good of humanity, Fred
<[email protected]> declared in
alt.html,alt.html.editors.webedit,alt.html.editors:

[alt.html.editors removed as it doesn't exist on my server]
On a page with all text, when the lines wrap at the right, some words butt
right up to the very edge of the screen.

Not by default in any graphical browser I know of. All have default
margin and/or padding on html and/or body.
I think I have seen code that makes the text take up only a certain amount
of the screen -- say 95%. Can someone pls give me a hand on this?

There are any number of ways, depending on exactly what you want.
Applying a small amount of padding to the text's containing element is
perhaps the simplest.
 
J

Jim Moe

Fred said:
I'm fairly new to HTML and so a pretty basic question....

On a page with all text, when the lines wrap at the right, some words butt
right up to the very edge of the screen. This makes it look like the text
runs off the screen, even though it doesn't.
Have you studied CSS (Cascading Style Sheets) yet? It is a powerful tool
for applying style rules to HTML markup.
In particular what you are looking for are margin or padding properties.
 
J

Jukka K. Korpela

Mark Parnell said:
[alt.html.editors removed as it doesn't exist on my server]

Followups trimmed to alt.html. There was no reason to crosspost in the first
place.
Not by default in any graphical browser I know of. All have default
margin and/or padding on html and/or body.

My guess is that OP, or the unspecified authoring tool he's using, has put
something on the page that removes those defaults. The most efficient
approach is probably to start over. Trying to fix some markup that was
generated by an authoring tool that does such nasty things, or to fix markup
one has copied from somewhere without understanding it, tends to lead to more
confusion rather than clarity.

Of course, I _could_ be wrong. The OP needs to post the URL (and to specify
the browser(s) in which the problem appears) to demonstrate this.
 
A

Andy Dingley

Fred said:
Can someone pls give me a hand on this?

Try the Psychic Hotline.

Otherwise post a URL to the broken page so that we can see it. Can't
fix what we can't see.
 
C

cypete

Hey what if you use paragraphs like this <p>some text here</p> and it
will stretch alright.
Hope this will help you..
 
D

dorayme

Fred said:
Greetings friends and neighbors!

I'm fairly new to HTML and so a pretty basic question....

On a page with all text, when the lines wrap at the right, some words butt
right up to the very edge of the screen. This makes it look like the text
runs off the screen, even though it doesn't.

I think I have seen code that makes the text take up only a certain amount
of the screen -- say 95%. Can someone pls give me a hand on this?

Thanks much!

Fred

Hi Fred,

In the head of your doc between <head> and </head> put this:

body {padding-right:10px}

and write away...

All the best,

The Nice One
 
F

frederick

dorayme said:
In the head of your doc between <head> and </head> put this:

body {padding-right:10px}

and write away...

That's nice. A shame that it won't actually do anything useful!

Perhaps you meant the following:

<style type="text/css">
body {padding-right:10px}
</style>

Not "best practice" either, but at least the browser'll do what was
intended!
 
D

dk_sz

D

dorayme

frederick said:
That's nice. A shame that it won't actually do anything useful!

Perhaps you meant the following:

<style type="text/css">
body {padding-right:10px}
</style>

Not "best practice" either, but at least the browser'll do what was
intended!

oops... Yes, I assumed too much...
 
F

Fred

Greetings friends and neighbors!

I'm fairly new to HTML and so a pretty basic question....

On a page with all text, when the lines wrap at the right, some words butt
right up to the very edge of the screen. This makes it look like the text
runs off the screen, even though it doesn't.

I think I have seen code that makes the text take up only a certain amount
of the screen -- say 95%. Can someone pls give me a hand on this?

Thanks much!

Fred
 
J

Jukka K. Korpela

Fred said:
On a page with all text, when the lines wrap at the right, some words butt
right up to the very edge of the screen. This makes it look like the text
runs off the screen, even though it doesn't.

You seem to think that the page is viewed in fullscreen mode. That's surely
possible, but you should think in terms of a _window_ or, most appropriately,
_canvas_ (the part of window or paper or other presentation area that is
allocated for rendering the document).
I think I have seen code that makes the text take up only a certain amount
of the screen -- say 95%. Can someone pls give me a hand on this?

That would be possible, but you really don't want that. In most browsers,
there is small but usually sufficient padding between the page content and
the canvas edge. Have you done something to remove it?

But if you think the default padding is insufficient, you can use a little
piece of CSS to suggest something slightly different, e.g.

<style type="text/css">
body { margin: 0;
padding: 0.4em 1em 0.4em 1.5em; }
</style>

This sets the top and and bottom padding to 0.4em, right padding to 1em and
left padding to 1.5em, which should be (more than) sufficient. The em unit
roughly corresponds to 2 or 2.5 times the average width of a character.

Followups rationalized.
 
A

Arne

Once said:
You seem to think that the page is viewed in fullscreen mode. That's
surely possible, but you should think in terms of a _window_ or, most
appropriately, _canvas_ (the part of window or paper or other
presentation area that is allocated for rendering the document).


That would be possible, but you really don't want that. In most
browsers, there is small but usually sufficient padding between the
page content and the canvas edge. Have you done something to remove
it?

But if you think the default padding is insufficient, you can use a
little piece of CSS to suggest something slightly different, e.g.

<style type="text/css"> body { margin: 0; padding: 0.4em 1em 0.4em
1.5em; } </style>

This sets the top and and bottom padding to 0.4em, right padding to
1em and left padding to 1.5em, which should be (more than)
sufficient. The em unit roughly corresponds to 2 or 2.5 times the
average width of a character.

Maybee you also should say that the peace of CSS should be set to the
header section of the page, concidering OP say he is "fairly new" to
HTML and the question is basic :)

So abowe the </head> in the source code is where it should be placed.
 
M

Mark Parnell

Deciding to do something for the good of humanity, Fred
I'm fairly new to HTML and so a pretty basic question....

You said all that 2 weeks ago. Did you not like the answers? They're
unlikely to change.

(alt.html.editors removed again as it still doesn't exist on my
newsserver, and follow-ups set to alt.html).
 
M

Michael Laplante

Fred said:
Greetings friends and neighbors!

I'm fairly new to HTML and so a pretty basic question....

Which browser are you using? What kind of page are you looking at -- can you
tell if it's just HTML, CSS / HTML, pure text file?

Post the page URL, or give me the "View source" view.

If you very new to HTML, the dead easiest way is to set up a one column
table.

<table style="width: 95%; text-align: left;" border="1" cellpadding="2"
cellspacing="2">
<tbody>
<tr>
<td>
Put your text file here.
</td>
</tr>
</tbody>
</table>

Of course, there's other stuff that has to go at the beginning and end of
your file but open any simple page, "View source" and you should be able to
figure it out. The text file will also need <br> or <p> tags to separate
paragraphs, otherwise you'll see one continuous sentence. If you don't want
to see a border around the table, well, you get the idea. . .

http://www.htmlcodetutorial.com/tables/


M
 
F

Fred

Thanks, Michael!!

Michael Laplante said:
Which browser are you using? What kind of page are you looking at -- can you
tell if it's just HTML, CSS / HTML, pure text file?

Post the page URL, or give me the "View source" view.

If you very new to HTML, the dead easiest way is to set up a one column
table.

<table style="width: 95%; text-align: left;" border="1" cellpadding="2"
cellspacing="2">
<tbody>
<tr>
<td>
Put your text file here.
</td>
</tr>
</tbody>
</table>

Of course, there's other stuff that has to go at the beginning and end of
your file but open any simple page, "View source" and you should be able to
figure it out. The text file will also need <br> or <p> tags to separate
paragraphs, otherwise you'll see one continuous sentence. If you don't want
to see a border around the table, well, you get the idea. . .

http://www.htmlcodetutorial.com/tables/


M
 
F

Fred

Thanks, JK!!

Jukka K. Korpela said:
You seem to think that the page is viewed in fullscreen mode. That's surely
possible, but you should think in terms of a _window_ or, most appropriately,
_canvas_ (the part of window or paper or other presentation area that is
allocated for rendering the document).


That would be possible, but you really don't want that. In most browsers,
there is small but usually sufficient padding between the page content and
the canvas edge. Have you done something to remove it?

But if you think the default padding is insufficient, you can use a little
piece of CSS to suggest something slightly different, e.g.

<style type="text/css">
body { margin: 0;
padding: 0.4em 1em 0.4em 1.5em; }
</style>

This sets the top and and bottom padding to 0.4em, right padding to 1em and
left padding to 1.5em, which should be (more than) sufficient. The em unit
roughly corresponds to 2 or 2.5 times the average width of a character.

Followups rationalized.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top