FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

what is span and p?

 


yo.hassan
i'll never know if i dont ask.. what is span actually? p and span are same? why should i use span over p if they are same?
snowboardalliance
yo.hassan wrote:
i'll never know if i dont ask.. what is span actually? p and span are same? why should i use span over p if they are same?


span is an inline element and p is block-level. If you don't know what I'm talking about, head over to google, it's a good idea to be familiar with the basics of html.
Agent ME
P is for paragraphs. It's just like div in that it is a basic block-level element, but it has some extra margin settings.
welshsteve
The <span> tag can be used to change the look of text within a paragraph. Here are two examples.

This code...
Code:

<p>This is a paragraph of text with <p style="color:#f00;">this particular text</p> enclosed within a nested &lt;p&gt; tag.</p>


..will look like this when rendered in a browser.

-------------------
This is a paragraph of text with
this particular text
enclosed within a nested <p> tag.
-------------------

Whereas, this code...
Code:

<p>This is a paragraph of text with <span style="color:#f00;">this particular text</span> enclosed within a nested &lt;span&gt; tag.</p>


..will look like this when rendered in a browser.

-------------------
This is a paragraph of text with this particular text enclosed within a nested <span> tag.
-------------------
rohan2kool
for god sake search the forums before posting questions. This has been asked and answered numerous many many times here. In case you are beginning HTML, head over to w3schools.com if you haven't already.
Aredon
Everything said up to now is all true however much detail is still lacking.

Within most block-level elements, block-level elements are permitted. However all block-level elements can contain inline elements. The divider(<div>) element is a generic block-level element and can contain both inline and block-level elements. The span(<span>) element is a generic inline element. An inline element cannot contain a block-level element unless specified with CSS however such coding is discouraged by the w3c and will not pass the validator. The paragraph(<p>) element is block-level yet has a functionality which forbids block-level elements from appearing within it. The paragraph element can be replaced by a combination of <div><span>...</span></div>.
©Wolfie
yo.hassan wrote:
i'll never know if i dont ask.. what is span actually? p and span are same? why should i use span over p if they are same?


Googling is the fastest way to find it out! Wink
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.