Jump to content

putting plain text to the browser,


Ninjakreborn

Recommended Posts

[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
Link to comment
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.
Link to comment
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.
Link to comment
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.
Link to comment
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]
Link to comment
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 :)
Link to comment
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]
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.