Jump to content

[solved]valadating css


redarrow

Recommended Posts

is there anyway i can use css to stop the code from being seen via the valadation on w3c


i have got the following in a texarea to show users the code but when i valadate the page i get errors becouse the code is already within the page so what do i do.

is it possable to show code within a teaxtarea and stop the code getting valadated maybe a css will do it.

[code]

---start code----

1.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

2."http://www.w3.org/TR/html4/strict.dtd">

3.<html>

4.<head>

5.<title>Hi ya</title>

6.<link rel="stylesheet" type="text/css" href="example2.css>

7.</head>

8.<body>


9.<p class="test">hi there i am <br>reddarrow</p>

10.</body>

11.</html>
-----end code-------
[/code]
Link to comment
Share on other sites

Are you typing plain html inot the textarea? If you are then this why. You should chnage the html characters into there html equivalents. EG:

< converts to & lt;
> converts to & gt;
& converts $ amp;
Note the examples above should not have a space before the & character. I had do this due to the forum pasing the html.

if you are adding the html in with php then use the htmlspecialchars function:
[code=php:0]$myhtmlvar = htmlspecialchars($myhtml);


echo '<textarea ..your html attributes here ...>' . $myhtmlvar . '</textarea>';[/code]

This will then prevent the validator from flagging errors.
Link to comment
Share on other sites

heres my code within the text area how do i do it dont get it sorry.

[code]

<div class="info">

Example 2

</div>

<div class="info_box_two">

<textarea class="info_box_two" >
---start code----

1.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

2."http://www.w3.org/TR/html4/strict.dtd">

3.<html>

4.<head>

5.<title>Hi ya</title>

6.<link rel="stylesheet" type="text/css" href="example2.css>

7.</head>

8.<body>


9.<p class="test">hi there i am <br>reddarrow</p>

10.</body>

11.</html>
-----end code-------
</textarea>

</div>
[/code]
Link to comment
Share on other sites

is this correct dosent work?

[code]
<div class="info">

Example 2

</div>

<div class="info_box_two">

<textarea class="info_box_two" >
---start code----

1.&gt!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

2."http://www.w3.org/TR/html4/strict.dtd"&lt

3.&gthtml&lt

4.&gthead&lt

5.&gttitle>Hi ya&lt/title&lt

6.&gtlink rel="stylesheet" type="text/css" href="example2.css&lt

7.&gt/head&lt

8.&gtbody&lt


9.&gtp class="test"&lthi there i am <br>reddarrow&gt/p&lt

10.&gt/body&lt

11.&gt/html&lt
-----end code-------
</textarea>

</div>y>


<p class="test">hi there i am <br>reddarrow</p>

</body>

<html>

[/code]
Link to comment
Share on other sites

Like this:
[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>example.html</title>
</head>
<body>


Hees my code:<br />
<textarea cols="50" rows="15">
&lt;!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;title&gt;example.html&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;


Hees my code:
&lt;textarea name=&quot;html&quot;&gt;

&lt;/textarea&gt;

&lt;/body&gt;
&lt;/html&gt;
</textarea>

</body>
</html>[/code]
Link to comment
Share on other sites

solved

Thank you so much never used them before ever more study dam!

[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>

<title>john</title>

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

</head>

<body>

<p>

<TEXTAREA rows="10" cols="10" class="info_box">

---start code----

1.
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;

2.
&lt;"http://www.w3.org/TR/html4/strict.dtd"&gt;

3.
&lt;html&gt;

4.
&lt;head&gt;

5.
&lt;title&gt; Hi ya
&lt;/title&gt;

6.
&lt;link rel="stylesheet" type="text/css" href="example2.css"&gt;


7.
&lt;/head&gt;

8.
&lt;body&gt;


9.
&lt; class="test">hi there i am br reddarrow p&gt;

10.
&lt;/body&gt;

11.
&lt;/html&gt;
-----end code-------
</textarea>


</body></html>

[/code]
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.