Solved

<STYLE> not working

Posted on 2006-10-27
6
231 Views
Last Modified: 2010-04-09
Based on what I'm reading in my HTML tutorial self-guide, I think the simple code below should run in my browser, but the <STYLE></STYLE> portion has no affect at all.  What am I doing wrong>>>

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Scripting Demo

<STYLE>
      <H3>{text-align: center}
      <P>{Color: #FF0000; font-style: Italic}
</STYLE>

</TITLE>
</HEAD>
<BODY>
<H3>This is a heading</H3>
<P>
This is a demo for using a style.
</P>

</BODY>
</HTML>
0
Comment
Question by:rlsokoloff
  • 4
6 Comments
 
LVL 54

Assisted Solution

by:b0lsc0tt
b0lsc0tt earned 63 total points
ID: 17822942
rlsokoloff,

Your style block needs to look like this instead.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Scripting Demo

<STYLE>
     H3 {text-align: center}
     P {Color: #FF0000; font-style: Italic}
</STYLE>

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17822962
I normally make it more readable by doing something like the example below.  Notice the element you identify in the style block is NOT in html tags (i.e. < or >).

h3 {
  text-align: center;
}

p {
  color: #ff0000;
  font-style: italic;
}
0
 
LVL 1

Accepted Solution

by:
cheetahshrk earned 62 total points
ID: 17822969
You wrote the css incorrectly, remove the < and > around the H3 and P in the style tags so it is
<STYLE>
     H3 {text-align: center}
     P {Color: #FF0000; font-style: Italic}
</STYLE>

Also, the </TITLE> needs to be moved to after the title and not after the style tag.
So it becomes <TITLE>Scripting Demo</TITLE>

In the end, your html file should look like this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Scripting Demo
</TITLE>

<STYLE>
     H3 {text-align: center}
     P {color: #FF0000; font-style: Italic}
</STYLE>

</HEAD>
<BODY>
<H3>This is a heading</H3>
<P>
This is a demo for using a style.
</P>

</BODY>
</HTML>
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17822981
Good catch on the title tag, Cheetahshrk.  I missed it.  Thanks!
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17823222
I'm glad that I could be one of those that helped you.  Thank you for the grade, the points and the fun question.

bol
0
 

Author Comment

by:rlsokoloff
ID: 17835520
I made a comment when I awarded points, but I see it didn't get posted.  Anyway here's basicly what it was.

Thank you to both!  I caught the bracket problem when b0lscott posted, but cheetahshrk explicitly pointed out the issue minutes later.  Also, as a bonus b0lscott's formatting suggestion was very helpful, as well as pointing out to move the </TITLE>  tag (required to work)..

Thanks again!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now