Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

putting plain text to the browser,

Recommended Posts

I sometimes see inside the html text dropped there, with no span, p, or pre tags.  Just put straight out to the browser, is this bad, if so why.

Share this post


Link to post
Share on other sites
Yeah... that doesn't make any bloody sense.

Share this post


Link to post
Share on other sites
[quote author=businessman332211 link=topic=109425.msg440991#msg440991 date=1159198023]
I sometimes see inside the html text dropped there, with no span, p, or pre tags.  Just put straight out to the browser, is this bad, if so why.
[/quote]

Whether it's "bad" or not depends on your definition of "bad".  If it means unstyled that might be ugly but still informative so it's artistically bad but functionally good.  Or maybe it means that the author actually put all of the dispay style inside the body styles ... or maybe I don't understand the question either.
No, it's not 'bad'. It strongly

Share this post


Link to post
Share on other sites
Ok, I see sometimes, most of the time, people put text in p tags.
Like
<p>Hello</p>
or something, or they use span, or something else.  But sometimes I see someone just put text straight to the browser,
Hello
instead
like have a word document, inside the content div, they have like

Hello, my name is dave, I watch tv a lot and each chips.
<br />
sometimes I don't care though
like that.

Share this post


Link to post
Share on other sites
And your question is what? There is no law that says text must be in html format to be on the internet you know? In fact alot of man pages are printed in plain text so that those of us using terminal browsers might view them.

Share this post


Link to post
Share on other sites
I have had w3schools.com return some errors before along the lines of text not enclosed with a block or inline element or something similar, I was thinking it could have had to do with something like this?

Share this post


Link to post
Share on other sites
No.  There is no reason text has to be enclosed in tags within the browser and this is no reason the validator would give an error because of that.

Share this post


Link to post
Share on other sites
Ok good, then that is something I can start doing instead of using those p tags all the time, sometimes i need to get text to the browser, without anything but the text.  Like without the extra spacing, margin, padding that comes with p tags, so this might help me a lot at specific times, I was just encasing everything in span tags.  So I can start doing that instead, thanks for the help.
actually that's why I was asking, I would take a whole notepad, with special formating, and try to use like p tags and everything, so instead I could just copy and paste the whole notepad onto a webpage, within the content area. Then just use a non-breaking space to get the indenting, that will be a lot faster.

Share this post


Link to post
Share on other sites
If you're just trying to get indentation on paragraphs, using p tags with some CSS will get you the indentation.

Share this post


Link to post
Share on other sites
I would say bad since [code]<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>test</title>
</head>
<body>

Hello

</body>
</html>[/code] do [i]not[/i] validate.

Share this post


Link to post
Share on other sites
[quote author=ober link=topic=109425.msg441074#msg441074 date=1159202609]
No.  There is no reason text has to be enclosed in tags within the browser and this is no reason the validator would give an error because of that.
[/quote]
It probably does, or ober would have said something about it.

Share this post


Link to post
Share on other sites
Ehhh, no it doesn't. Try to look at this: http://validator.w3.org/check?uri=http://xaos-ia.com/do_not_validate.html&ss=1

[quote]You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).[/quote]

Share this post


Link to post
Share on other sites
Wow... you're kidding me.  That must have changed because I don't think that's always been the case.

Share this post


Link to post
Share on other sites
I think it has been like that in quite a while, but I was not sure so I had to verify it by creating a document and validate it. I'm not sure if it is like that in XHTML 1.0 Transitional, but I personally think that you should use the latest version.

Share this post


Link to post
Share on other sites
Ahh... see, that's what it comes down to.  It's all about the headers.  Personally, I think some of the headers are too strict... that's one reason why I never use strict and I've always stuck with transitional.

Share this post


Link to post
Share on other sites
strict gets pretty tough, but makes more sense.  Text has to be defined in some type of element. 

Share this post


Link to post
Share on other sites
[quote author=businessman332211 link=topic=109425.msg441204#msg441204 date=1159211302]
So now everything is back to square one, for some people it's good, and for some people it's bad?
[/quote]

No, go back and re-read the commentary on DTD type.  For 'good' people it's bad; for 'bad' people it's good enough :)

Share this post


Link to post
Share on other sites
No ones is saying its "bad". Just people have different opinions on which version of xHTML to use. I tend to use XHTML Transitional rather than XHTML Strict when creating XHTML pages.

As long as the text is not on its own between the body tags and is defined in a div or some other tag, eg:
[code]<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>test</title>
</head>
<body>

<div id="container">
  <div id="header"><h1>Some Header</h1></div>
  <div id="menu">Menu here</div>
  <div id="content">Hello</div>
  <div id="footer">Footer</div>
</div>

</body>
</html>[/code]
It'll be fine.

Sometime I tend to this:
[code]<div id="content">
  some opening paragrah

  <p>Secound paragraph</p>

  <p>Third paragraph</p>

  Last paragraph
</div>[/code]

Share this post


Link to post
Share on other sites
I should probably add that I do something similar.  All my text is in some kind of div or something. 

Share this post


Link to post
Share on other sites
It makes more sense to create a web page and enclose the text in HTML tags. Unless your doing a manual, and then no one is going to validate the damn manual. They are just going to read it and be done with it.

Also businessman, if you want to validate your pages, and be lazy about the p tag at the same time, use Transitional and stay away from Strict. But if you want to put a bit of effort into your sites, and actually do the work of enclosing your text in some type of tag (p, div, span, etc) then use strict, and do what it requires you to do to meet its expectations

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.