Question:
what does P, .P, and #P in CSS mean?
?
2011-09-05 11:06:53 UTC
computer assignment, can anyone tell me where to get some more info?
Six answers:
Andron Smith
2011-09-05 11:46:48 UTC
what you are using is called selectors.



P is a selector, in CSS any style you apply to this will effect all "P" tags. use this when you want to apply styles to all of a select tag.



P {

font-family: "Times new Roman";

}



.P is a class selector. Ignore the above comment saying using this is not a good idea. This is used to decipher which specific element you would like to apply the style to. For example you have 100 P tags on your page. you want to change one of the specific ones. you can set the class name for one then just target that specific element.



This is a P statement



This will not be effected









or



P.P{

color: pink;

}



lastly #P is a id selector. use it to identify names on the page with the 'id' key word. Example:







then in the css you can



P#P {

text-decoration: underline;

}



or



#P {

font-weight: bold;

}





these are basically ways you refer and select elements on the page to be styled. They are quite useful and wise to use them.

bobenny
2011-09-05 19:05:56 UTC
P is the tag for a paragraph. So, in your stylesheet, when you put p { text-align: center; }, for example, then it will make text that are in paragraphs or have the

tags around it align center.



Anything in a stylesheet that has a period before it is a class. If you make a class called "cheeseburger" and the tags in the HTML look something like
, then in the stylesheet, you have to put .cheeseburger { [some styling goes here] }. All classes are periods before them in the stylesheet.



The same thing that applies to classes applies to IDs, ex:
and in the stylesheet it will be #hamburger { [some styling goes here] }. IDs have hashtags before them in the stylesheet. The difference between a class and an ID is that classes can be used multiple times on an HTML page and IDs should only be used once.



I hope that helped; I know that it's difficult to understand but soon you'll get it!
anonymous
2011-09-05 18:23:42 UTC
It means someone doesn't know how to use CSS. "p" is considered a keyword for paragraph tag so all you would need for CSS is the letter "p":



p {

font-family: arial;

font-size: 1em;

}



The use of "p" as a class (.p) is not a good idea. Nor is the use of "p" as an ID (#p).



CSS Tutorials:



http://www.handycss.com/

http://www.w3schools.com/Css/default.asp

http://www.w3.org/Style/Examples/011/firstcss

http://www.csstutorial.net/

Dynamic Drive CSS Library: http://www.dynamicdrive.com/style/



http://www.echoecho.com/css.htm

http://htmldog.com/guides/cssbeginner/

http://www.davesite.com/webstation/css/

http://www.htmlcodetutorial.com/character_famsupp_193.html



Ron
Kanchana
2011-09-05 18:10:02 UTC
P = tag p





.P = a class called P



#P = an ID of a object or a tag for example

anonymous
2011-09-05 18:08:56 UTC
When playing CS:S, people will often use taunts and those taunts seem to be variants of the smiley face ":P" which is them sticking their tongue out at you. Don't be such a counter-strike nub and you wont see that anymore.
Robbin
2011-09-05 19:51:06 UTC
Hi.



"p" is the paragraph selector which refers to all paragraphs in HTML file like:

-------



This is a paragraph

(in HTML)



------------------------------------------------------



and you refer to it in CSS like this:

p {

color: red;

}(CSS)



-------------------------------------------------------------------------------------------------------------------------------------



".p" is1. a class selector which refers to a maintained class selector in HTML like:

--------



this is used for a specific paragraph of your choice

(HTML)note: you don't insert the dot here.

---------------------------------------------------

and you refer to it in CSS like this:

.p {

color: red;

font-weight: bold;

}(CSS it is rare you use a .p as a name for your selector, you shouldn't, you get confused)



--------------------------------------------------------------------------------------------



2. is again a class selector which is applied to specific HTML element (used alot) like:

----------

paragraph1



paragraph 2



paragraph 3



paragraph 4

(HTML)

------------------------------------------------

and you refer to it in CSS like this:



p.p {

font-style= bold;



}(CSS) this way just the paragraphs which has "p as class" get bold NOTE: the first one doesn't.



----------------------------------------------------------------------------------------------------------------------------------------------



"#p" is an id selector which refers to a maintained id selector in HTML like:

------------------





your name or mine





this is an id selector which is very useful all the times





(HTML)

-----------------------------------------------



and you refer to it in CSS like this:



#top {

color: blue;

background-color: green;

}(CSS)







----------------------------------------------------------------------------------------------------------------------------------





hope it helped.

have fun.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...