SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Enthusiast antitoxic's Avatar
    Join Date
    Apr 2008
    Location
    London, UK
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Styling <code>. Are tags inside read as code by search engines

    I think I will style some elements in my code (line background, possibly tag color) and it definitely needs span inside .
    Is this SEO friendly or whatever you want to call it. Are spans indexed as code or ignored just to be wrappers for the code (it seems the right way) ?

    Example
    Code:
    <code>
    <span id="not_semantic_part_of_code">&lt;li&gt;List item text&lt;/li&gt</span>
    </code>

  2. #2
    SitePoint Member
    Join Date
    Aug 2008
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think it's being used right as a container. Go with

    Code HTML4Strict:
    <code id="not_semantic">...</code>
    and style that id.

  3. #3
    SitePoint Enthusiast antitoxic's Avatar
    Join Date
    Apr 2008
    Location
    London, UK
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    May be I was not clear , the text inside span is semantic. It is the code I will show. But does the actual span wrapper for colorful decoration of markup is indexed just as inhere the code examples:
    HTML Code:
    <code>
    <span id="yellow">&lt;li&gt;List item text&lt;/li&gt</span>
    </code>

  4. #4
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why can't you just style the <code> element instead of trying to have an extra span?
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  5. #5
    SitePoint Enthusiast antitoxic's Avatar
    Join Date
    Apr 2008
    Location
    London, UK
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is just an example. There are collosal number of lines . You suggest using <code> inside code (it is valid i think)?

  6. #6
    SitePoint Member
    Join Date
    Aug 2008
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've seen <code> being used on small snippets of code, for a bunch of lines it is being used <pre> or simply
    Code HTML4Strict:
    <div class="codecontent">
    <span class="highlight_stuff">...</span>
    <span class="highlight_other_stuff">...</span>
    </div>
    Last edited by Buguletzu; Aug 24, 2008 at 23:23.

  7. #7
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For code snippets either use <pre> or <code>.

    If you need to apply two "layers" of styling to either than simply wrap it in a DIV or SPAN or whatever is appropriate.
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  8. #8
    SitePoint Enthusiast antitoxic's Avatar
    Join Date
    Apr 2008
    Location
    London, UK
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JimmyP View Post
    If you need to apply two "layers" of styling to either than simply wrap it in a DIV or SPAN or whatever is appropriate.
    Great then, I can use SPAN wrapper without search engines confusing it for to be part of the code .

    Cheers all.

  9. #9
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Search engines will not confuse &lt;html&gt; for actual code - putting your code snippets in a CODE element is no different than placing it in P element other than the fact that one is semantically incorrect.
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  10. #10
    SitePoint Enthusiast antitoxic's Avatar
    Join Date
    Apr 2008
    Location
    London, UK
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [: My real concern was whether the SPAN will be indexed in google database as part of my <code>. Don't search engines have semantic layer in their database?... for instance h1,h2,h3 - titles, p - paragprahp, li - ohh list item, strong - tasty tasty content, code - code snippet

    Ta.. Span wont be included in this "code snippet" semantic tagging . That's what I needed to know.

    Fish and bread for all of you [:

  11. #11
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JimmyP View Post
    For code snippets either use <pre> or <code>.
    You should probably use both:
    Code HTML4Strict:
    <pre><code>...</code></pre>

    The pre element says the content is pre-formatted and that white space has semantic value within; the code element says the content is some sort of computer code.

    Quote Originally Posted by antitoxic View Post
    [: My real concern was whether the SPAN will be indexed in google database as part of my <code>.
    No, it's markup, not content.
    Birnam wood is come to Dunsinane

  12. #12
    SitePoint Enthusiast antitoxic's Avatar
    Join Date
    Apr 2008
    Location
    London, UK
    Posts
    93
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    You should probably use both:
    Code HTML4Strict:
    <pre><code>...</code></pre>

    The pre element says the content is pre-formatted and that white space has semantic value within; the code element says the content is some sort of computer code.


    No, it's markup, not content.
    Direct shot in the point . Thank you. I used them both, yes. Because of several issues when using just css white-space property.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •