Jump to content

css tutorial id selector


rainwater

Recommended Posts

on this page, I do not understand the

<p id="para1">Me too!</p>

as there is no <p id=para1"> in the <head> <style>

 

Will you please explain this for me?

 

http://www.w3schools.com/css/tryit.asp?filename=trycss_syntax_element

<!DOCTYPE html>
<html>
<head>
<style>
p {
text-align: center;
color: red;
}
</style>
</head>
<body>
<p>Every paragraph will be affected by the style.</p>
<p id="para1">Me too!</p>
<p>And me!</p>
</body>
</html>

 

Link to comment
Share on other sites

It's just an id attribute. It's not doing anything in that example.

 

Perhaps they're just trying to show that the style applied to the paragraph even when it has an id.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...