189k views
3 votes
James wants to create a web page where he can write two paragraphs of text. The first paragraph of text should be colored red and the

second blue. Which snippet of code show the principle behind how James creates this page?

James wants to create a web page where he can write two paragraphs of text. The first-example-1

1 Answer

4 votes

Answer:

The first code does it

Step-by-step explanation:

Each of the attached code snippet is divide into two parts.

  • The CSS part
  • The html part

From the four code snippets, the first one answers it.

The syntax to format the paragraph of an html text using css is:

p#paragraph-id{

color:color-name

}

Analysing each element

p# -> This implies that a paragraph is to be formatted

paragraph-id -> This represents the id of the paragraph

{} -> The open and close curly braces house the properties to be formatted

color:color-name -> implies that the color of the element be changed to color-name (e.g. red or blue)

In the body tag of the html code, the first paragraph has an id of para1 and the second has para2 as its id.

i.e. <p id = "para1">......

So, the first paragraph will be formatted red while the second will be blue

User Jeff Escalante
by
4.9k points