Help - Search - Members - Calendar
Full Version: what is wrong with html
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
jassie
I am wondering in a web page if the following html is valid for the span tags? If not would you show me what I can do to make the html valid?
1. Basically there is a main span tag of <
span style="font-size: 13px;font-family: arial,sans-serif; color: black;">
and a final span label.
2, Are the embedded span tags correct?
Here is an example of some html that is send to an asp.net web page:
<span style="font-size: 13px;font-family: arial,sans-serif; color: black;"><p>&nbsp;</p> <p></p> <p></p> <p> </p><br /><br />&amp;CUR_DATE.EVAL</p><br /><br /><br /><br /><br /><br /><p> </p> <p>To the &amp;PAR_NAME.EVAL of &amp;STU_FNAME.EVAL &amp;STU_LNAME.EVAL<br /> <span id="ADDR_BEG"></span>&amp;PAR_ADDR.EVAL<br /><span id="ADDR_NEXT"></span>&amp;PAR_CITY.EVAL, &amp;PAR_STATE.EVAL &amp;PAR_ZIP.EVAL<br /><span id="ADDR_END"></span> <br /><br /><br /> <br /> <br /> Dear &amp;PAR_NAME.EVAL and &amp;STU_FNAME.EVAL &amp;STU_LNAME.EVAL:<br /> <br /> <br />
Sincerely,<br /> <br /> <br /> &amp;SPA_NAME.EVAL<br /> &amp;SPA_EMAIL.EVAL<br /> School Support Liaison/ Attendance Designee<br /> &amp;SCHOOLNAME.EVAL<br /> <p> &amp;PERMNUM</p></span>
Christian J
QUOTE(jassie @ Dec 19 2018, 05:18 PM) *

I am wondering in a web page if the following html is valid for the span tags? If not would you show me what I can do to make the html valid?

No, you can't put a P element inside a SPAN. Use say a DIV element instead of the main SPAN.

QUOTE
</p><br /><br />&amp;CUR_DATE.EVAL</p>

This part is also invalid, there's a stray end P tag. The validator at http://validator.w3.org/ can point out such errors (even though the error reports are sometimes cryptic).

It's also best to avoid BR elements for text formatting. Either use a bullet list (UL and LI elements) or possibly P elements with CSS margin/padding/width.

It's also unpractical to use inline styles (the STYLE attribute), put the CSS in a stylesheet instead.
jassie
The part where the span tag is at the beginning is intended for the font to be the same size in the entire html. Also there is no css on the web page. would you show me how to make the font all the same size?

Your comment ,"It's also best to avoid BR elements for text formatting. Either use a bullet list (UL and LI elements) or possibly P elements with CSS margin/padding/width." There is no css. I basically want blank lines. should I use p tags or what do you suggest?

Your comment. "It's also unpractical to use inline styles (the STYLE attribute). Can you tell me what inline styles are?
pandy
There is a lot of CSS. Everything you have as value of style attributes is CSS. smile.gif

Only, there is little point of using CSS if you put everything in style attributes. Reserve that for quick changes. If all you want is the same font for the whole page you need neither SPAN nor DIV.

Take this.

CODE
body   { font-size: 13px; font-family: arial, sans-serif }


It can also be written with shorthand, like this.

CODE
body   { font: 13px Arial, sans-serif }


Now you have two options. Either put that line in a style block placed within HEAD. Like so.

HTML
<head>

<title>Your title</title>

<style type="text/css">
body { font: 13px Arial, sans-serif }
</style>

</head>


Or put the line in an otherwise totally empty document and save it as whatever.css .

Then you link to it in HEAD like this (if the CSS file is in the same folder as the HTML).

CODE
<link rel="stylesheet" type="text/css" href="whatever.css">


The advantage of a linked style sheet is that it can be used with all your pages. You could even use it with several sites, if you want. If you want to change something about the font it's enough to edit that single line. But for testing and learning a style block in HEAD may be more handy.

You should read the CSS tutorial. It's CSS1 only, but that doesn't matter because that's what you want to use to start with and you can move on to more advanced things later. It's short and easy to follow.
http://htmlhelp.com/reference/css/

I know you are new. But it's a lot easier to learn if you get it right from the beginning. Relearning and rewriting is no fun. happy.gif
Christian J
QUOTE(jassie @ Dec 20 2018, 01:08 AM) *

I basically want blank lines. should I use p tags or what do you suggest?

Exactly what HTML to use depends on the semantics of the text content. This looks like an email/letter template, and for the addresses you are indeed encouraged to use (a single) BR element for line breaks: https://www.w3.org/TR/html/textlevel-semant...l#elementdef-br but for separating the text paragraphs you should use P (and CSS to increase the vertical margin between each P element).
pandy
An email template? Forget what I said about linked style sheets in that case. Inline CSS is probably good in that context.
Christian J
QUOTE(pandy @ Dec 20 2018, 12:42 PM) *

An email template? Forget what I said about linked style sheets in that case. Inline CSS is probably good in that context.

I'll let the OP answer that, but:

QUOTE(jassie @ Dec 19 2018, 05:18 PM) *

Here is an example of some html that is sent to an asp.net web page:

Also there are ASP variables(?) like these:

QUOTE
CODE
&amp;CUR_DATE.EVAL

suggesting that a web server (rather than an email) is used. unsure.gif



pandy
It was you that suggested an email TEMPLATE and I bought it. tongue.gif

But a template on the server, obviously. If so, the HTML would still be in the email.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2019 Invision Power Services, Inc.