Can I use a span tag outside a p?
I was placing some icon fonts inside a link and then i asked myself:
is semantically correct to use a
span tag outside a
<a href="http://fb.com"> <span class="my-icon-font">link</span> </a>
From a semantic perspective, a
span really doesn't mean much. It's just a marker for some inline content.
From a technical perspective, a
span can go anywhere that you have an
inline display context, which basically means anywhere at all (since HTML allows you to have inline elements in the same context as block elements).
It certainly isn't limited to being inside a
p tag. It can go pretty much anywhere.
<p> vs <span> - HTML & CSS, Generally <div> tags are used for block-level elements that require of the picture outside the crop marks, AP elements can mask the area outside the clipping Tags that can be placed inside a <a> tag. The hyperlink tag is an inline element so the following tags can be placed inside it: Common tags: em, strong, br, pre, a, span, img, label. Less common tags: dfn, code, samp, kbd, var, cite, abbr, acronym, sub, sup, small, mark. DO NOT place the following tags in <a>: div, p, h1, h2, …, h6, ul, table
Yes; there is nothing wrong with that.
However, you might as well move the
class to the
Dreamweaver® CS4 Bible, The HTML span element is a generic inline container for phrasing content, which does not inherently represent anything. It can be used to The span tag is inside the paragraph tags, and I added the style attribute to the span element that tells the browser to show the text as red. Remember it is not ideal to embed styles inside the body, but it illustrates my point. Instead, I would typically create a class for a specific purpose, but we will get to that in the CSS tutorials
Sure, there's nothing wrong with that. As long as you don't do this:
<a href="http://fb.com"> <span class="my-icon-font">link </a></span>
And, since your tag covers the whole same text as your does, it is better to add the class to the tag:
<a href="http://fb.com" class="my-icon-font"> link </a>
<span>, Generally, <div> tags are used forblocklevel elements that requirepositioning, and delete the portion of the picture outside the crop marks, AP elements can. The HTML span element is a generic inline container for inline elements and content. It used to group elements for styling purposes (by using the class or id attributes), A better way to use it when no other any other semantic element is available. span is very similar to the div tag, but div is a block-level tag and span is an inline tag.
The short answer is NO
You can read these two section
Contexts in which this element can be used: Where phrasing content is expected.
Contexts in which this element can be used: Where flow content is expected.
Content model: Phrasing content.
span just allows phrasing content element inside it while a
p is an flow content element. However, a
p can contains a
Would make sense to use where, for example, you might want to emphasize the text of more than one paragraph in sequence. Otherwise, I would just use a class inside my
tag to emphasize the text.
span Tag, To me, learning to use the div element means you've moved from beginner's the structural sections of a document and for laying out a web page using CSS. give you a quick example of how you can use a div element to style a paragraph. With beautiful soup I can get contents within that span tag. Is there any way to just get the content of the outer span and ignoring whatever is within the inner span tag? i.e. it should give me only 210. If the above is not possible, then is there any further improvements you suggest with regards to re or the code in general?
The DIV and SPAN Elements » Best Practices Web Design, That's why you can use <p> tag inside a <div> HTML element but semantically, Putting text in a <div> or in a <p> is not something you should be tweaking. There is a difference between the span tag and the div tag. The span tag is used with inline elements whilst the div tag is used with block-level content. Example
Use p tag inside a div tag for text?, width as necessary. This is a <span> element inside a paragraph. When used together with CSS, the <div> element can be used to style blocks of content: However, it’s what we can do with the span that’s important. Lloyd tells us: A span is little more than a tool for highlighting the start and end of a section to which you want to apply a style. Using the span, we can hang a styled class on a chunk of text inside a paragraph to transform it on the display. Let’s say we want to create a
HTML Block and Inline Elements, I just want to make sure if it is correct to use the paragraph tag before the link tag 'p's outside of 'li's will be in Garamond, and 'p's INSIDE 'li's will be in Verdana. wrapper DIV, or a P, even, though p is semantically prose, not a list container. But for SEO purposes is it better to use the p tag inside the div or just use the text directly in the div ? The result is the same ( visually ). PS: i understand that the general idea is that p is more relevant for seo than div ( or at least this is what i heard. please correct me if i am wrong here) .