Simple HTML question

Discussion in 'HTML' started by Ian Davies, May 1, 2006.

  1. Ian Davies

    Ian Davies Guest

    I wish to refer to a line of HTML code without activating that code in my
    documents. So, for example, if I want to describe the string of code needed
    to make a link, I can do so without creating the link itself, rather than
    the code. How is this acheived

    Thanks
    Ian
    Ian Davies, May 1, 2006
    #1
    1. Advertising

  2. Ian Davies

    Toby Inkster Guest

    Ian Davies wrote:

    > I wish to refer to a line of HTML code without activating that code in my
    > documents.


    Try this:-

    <p>Here is how you make something bold:
    <code>&lt;b&gt;bold&lt;/b&gt;</code>.</p>

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, May 1, 2006
    #2
    1. Advertising

  3. Ian Davies

    Neredbojias Guest

    To further the education of mankind, "Ian Davies"
    <> vouchsafed:

    > I wish to refer to a line of HTML code without activating that code in
    > my documents. So, for example, if I want to describe the string of
    > code needed to make a link, I can do so without creating the link
    > itself, rather than the code. How is this acheived


    Put the "code" in a <p> or something and escape the "<" with &lt; and the
    ">" with &gt;

    --
    Neredbojias
    Infinity has its limits.
    Neredbojias, May 1, 2006
    #3
  4. Ian Davies

    Martin Jay Guest

    In message <vao5g.21454$>, Ian Davies
    <> writes
    >I wish to refer to a line of HTML code without activating that code in my
    >documents. So, for example, if I want to describe the string of code needed
    >to make a link, I can do so without creating the link itself, rather than
    >the code. How is this acheived


    Use:

    &lt;a href="index.html"&gt;Index page&lt;/a&gt;

    or, maybe:

    &lt;a href=&quot;index.html&quot;&gt;Index page&lt;/a&gt;

    instead of:

    <a href="index.html">Index page</a>

    For example &lt; instead of < and &gt; instead of >.

    There's a list at:

    <http://www.htmlhelp.com/reference/html40/entities/special.html>

    And perhaps put your code between <code></code> or <pre></pre> HTML
    tags. There's some info here:

    <http://www.htmlcodetutorial.com/quicklist.html>
    --
    Martin Jay
    Martin Jay, May 1, 2006
    #4
  5. Toby Inkster wrote:

    > Ian Davies wrote:
    >
    >> I wish to refer to a line of HTML code without activating that
    >> code in my documents.

    >
    > Try this:-
    >
    > <p>Here is how you make something bold:
    > <code>&lt;b&gt;bold&lt;/b&gt;</code>.</p>


    It just occurred to me that it seems like "<code>foo</code>"
    should make foo inert by definition. I mean, as part of the
    design intent of "<code>" it seems like using that implies "this
    is a representation of code, not code to be processsed here".

    I hope that made sense; it was clear here. :)


    --
    Blinky
    Kill-filing all posts from Google Groups
    Details: http://blinkynet.net/comp/uip5.html
    Blinky the Shark, May 1, 2006
    #5
  6. Ian Davies

    Ian Davies Guest

    thanks all
    thats solved it
    ian

    "Martin Jay" <> wrote in message
    news:BsRs$...
    > In message <vao5g.21454$>, Ian Davies
    > <> writes
    > >I wish to refer to a line of HTML code without activating that code in my
    > >documents. So, for example, if I want to describe the string of code

    needed
    > >to make a link, I can do so without creating the link itself, rather than
    > >the code. How is this acheived

    >
    > Use:
    >
    > &lt;a href="index.html"&gt;Index page&lt;/a&gt;
    >
    > or, maybe:
    >
    > &lt;a href=&quot;index.html&quot;&gt;Index page&lt;/a&gt;
    >
    > instead of:
    >
    > <a href="index.html">Index page</a>
    >
    > For example &lt; instead of < and &gt; instead of >.
    >
    > There's a list at:
    >
    > <http://www.htmlhelp.com/reference/html40/entities/special.html>
    >
    > And perhaps put your code between <code></code> or <pre></pre> HTML
    > tags. There's some info here:
    >
    > <http://www.htmlcodetutorial.com/quicklist.html>
    > --
    > Martin Jay
    Ian Davies, May 1, 2006
    #6
  7. Blinky the Shark wrote:

    > It just occurred to me that it seems like "<code>foo</code>"
    > should make foo inert by definition. I mean, as part of the
    > design intent of "<code>" it seems like using that implies "this
    > is a representation of code, not code to be processsed here".


    No, it just says that it is code. It is more than possible that an author
    might want to give emphasis to part of it, or hyperlink sections (e.g. a
    function call to a function definition), so it would be unhelpful for it to
    prevent markup being processed.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, May 1, 2006
    #7
  8. Ian Davies

    Toby Inkster Guest

    Blinky the Shark wrote:

    > It just occurred to me that it seems like "<code>foo</code>"
    > should make foo inert by definition.


    Do you mean that <code><b></code> should be equivalent to
    <code>&lt;b&gt;</code>?

    If so, they tried that with <xmp>, but that was deprecated as of HTML 4 as
    it is impractical for many reasons:

    - what if you actually want to include some bold text
    within your code fragment (useful for syntax highlighting
    for example)?
    http://test.tobyinkster.co.uk/Preview/Syntax-Highlighting/test.php

    - it makes parsing difficult

    - it doesn't fit in nicely with SGML rules, making validation
    tricky.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, May 1, 2006
    #8
  9. Ian Davies

    Jose Guest

    > It just occurred to me that it seems like "<code>foo</code>"
    > should make foo inert by definition.


    Except for browsers that don't support the code tag.

    Jose
    --
    The price of freedom is... well... freedom.
    for Email, make the obvious change in the address.
    Jose, May 1, 2006
    #9
  10. Toby Inkster wrote:

    > Blinky the Shark wrote:
    >
    >> It just occurred to me that it seems like "<code>foo</code>"
    >> should make foo inert by definition.

    >
    > Do you mean that <code><b></code> should be equivalent to
    > <code>&lt;b&gt;</code>?


    I mean that something in the code element should not be operated
    upon; it should just be displayed.

    > If so, they tried that with <xmp>, but that was deprecated as of
    > HTML 4 as it is impractical for many reasons:
    >
    > - what if you actually want to include some bold text
    > within your code fragment (useful for syntax highlighting
    > for example)?


    I guess you'd be out of luck.

    > http://test.tobyinkster.co.uk/Preview/Syntax-

    Highlighting/
    > test.php
    >
    > - it makes parsing difficult


    Why?

    > - it doesn't fit in nicely with SGML rules, making
    > validation
    > tricky.


    I'll have to believe you on faith, there.


    --
    Blinky
    Kill-filing all posts from Google Groups
    Details: http://blinkynet.net/comp/uip5.html
    Blinky the Shark, May 1, 2006
    #10
  11. Jose wrote:
    >> It just occurred to me that it seems like "<code>foo</code>" should
    >> make foo inert by definition.

    >
    > Except for browsers that don't support the code tag.


    And which browsers might that be?

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, May 2, 2006
    #11
  12. Ian Davies

    Jose Guest

    >> Except for browsers that don't support the code tag.
    >
    > And which browsers might that be?


    Older ones.

    I don't have a list (nor do I really care), but it good design to design
    standards that don't break in older browsers. That is the way I believe
    HTML is set up - if a tag is unrecognized, it is ignored. A code tag
    that is ignored leaves what's inside to be interpreted raw. So, what's
    inside needs to be safe raw, and the code tag needs to take that into
    account when it's interpreted.

    Jose
    --
    The price of freedom is... well... freedom.
    for Email, make the obvious change in the address.
    Jose, May 2, 2006
    #12
  13. Jose wrote:
    >>> Except for browsers that don't support the code tag.

    >>
    >> And which browsers might that be?

    >
    > Older ones.
    >
    > I don't have a list (nor do I really care), but it good design to design
    > standards that don't break in older browsers. That is the way I believe
    > HTML is set up - if a tag is unrecognized, it is ignored. A code tag
    > that is ignored leaves what's inside to be interpreted raw. So, what's
    > inside needs to be safe raw, and the code tag needs to take that into
    > account when it's interpreted.


    How old do you want to go here MSIE4.x and NN4.x recognize the tag and
    their usage is less than 1/10 percent!

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, May 2, 2006
    #13
  14. Ian Davies

    Jose Guest

    > How old do you want to go here MSIE4.x and NN4.x recognize the tag and their usage is less than 1/10 percent!

    When designing a compatible =standard=, you (or at least I would) go as
    far back as time.

    Jose
    --
    The price of freedom is... well... freedom.
    for Email, make the obvious change in the address.
    Jose, May 2, 2006
    #14
  15. Jose wrote:
    >> How old do you want to go here MSIE4.x and NN4.x recognize the tag and
    >> their usage is less than 1/10 percent!

    >
    > When designing a compatible =standard=, you (or at least I would) go as
    > far back as time.


    So you never use a table, right? First IE didn't support them....be real
    now!

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, May 2, 2006
    #15
  16. Ian Davies

    Jose Guest

    > So you never use a table, right? First IE didn't support them....be real now!

    It's not a question of whether I use a whatever as a WEB designer, it's
    a question of =how= to design the =standards= for a whatever, as a
    STANDARDS designer.

    And yes, in the earlier years (not too long ago actually) I had avoided
    tables when possible so as to be useful in more browsers. I now use
    tables (but don't like them much as a user because cut and paste don't
    work well).

    Were I to DESIGN the code tag, I would design it such that whatever was
    inside the code tag would still be able to be marked up, because
    browsers that do not support the code tag would present the content as
    is, and I would expect the web designer to have the option of marking it
    up appropriately for such a case.

    Were I to USE the code tag, I would expect what's inside to be
    interpreted as HTML and require escape codes to display characters that
    would otherwise be "live".

    Jose
    --
    The price of freedom is... well... freedom.
    for Email, make the obvious change in the address.
    Jose, May 2, 2006
    #16
  17. Ian Davies

    ironcorona Guest

    Jose wrote:

    > Were I to DESIGN the code tag, I would design it such that whatever was
    > inside the code tag would still be able to be marked up, because
    > browsers that do not support the code tag would present the content as
    > is, and I would expect the web designer to have the option of marking it
    > up appropriately for such a case.
    >
    > Were I to USE the code tag, I would expect what's inside to be
    > interpreted as HTML and require escape codes to display characters that
    > would otherwise be "live".


    I disagree. What else, then, is the point of the <code> tag if not to
    be used to display the exact content of the tag (as opposed to the
    marked up version). People don't usually use scripts (or whatever) to
    search through HTML documents to parse the contents of a <code> tag in
    order to extract the code itself and since the tags are not meant to be
    read by humans (after the browser gets hold of it) it seems weird that
    you would have ANOTHER tag that sets out an area.

    Most of those old tags should be depreciated because you can you the
    "class" or "id" attribute to mark off specific areas, as per the ideal
    of separating style from content: using <span> or <div> in conjunction
    with CSS is just as useful.

    <code> would be much more useful to show areas of plaintext which the
    browser doesn't mark up.

    --
    ironcorona
    ironcorona, May 2, 2006
    #17
  18. Jose wrote:
    >> So you never use a table, right? First IE didn't support them....be
    >> real now!

    >
    > It's not a question of whether I use a whatever as a WEB designer, it's
    > a question of =how= to design the =standards= for a whatever, as a
    > STANDARDS designer.
    >
    > And yes, in the earlier years (not too long ago actually) I had avoided
    > tables when possible so as to be useful in more browsers. I now use
    > tables (but don't like them much as a user because cut and paste don't
    > work well).


    Not use what you mean CODE element has be part of the markup repertoire
    since 2.0 back in 94 so basically every graphical browser supports it.
    12 years ago, thats eons in computer years!

    >
    > Were I to DESIGN the code tag, I would design it such that whatever was
    > inside the code tag would still be able to be marked up, because
    > browsers that do not support the code tag would present the content as
    > is, and I would expect the web designer to have the option of marking it
    > up appropriately for such a case.


    If the content is computer code then semantically it is proper to use
    the CODE element. If it is a paragraph, use P. If is it a list, use UL
    or OL. If the data is tabular then use a TABLE by all means. It would be
    wrong really to put tabular data in a series of positioned DIVs

    >
    > Were I to USE the code tag, I would expect what's inside to be
    > interpreted as HTML and require escape codes to display characters that
    > would otherwise be "live".


    CODE element just denotes that the contained text is source code of some
    sort and is usually displayed in a monospaced font. Nothing is escaped,
    you still need html entities like &gt; and &lt;

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, May 2, 2006
    #18
  19. ironcorona wrote:

    > I disagree. What else, then, is the point of the <code> tag if not to
    > be used to display the exact content of the tag


    To state that the data being marked up is code (and thus to allow the user
    agent to inform the user of the fact).

    > Most of those old tags should be depreciated because you can you the
    > "class" or "id" attribute to mark off specific areas, as per the ideal
    > of separating style from content: using <span> or <div> in conjunction
    > with CSS is just as useful.


    "This section is text is some code" is not "style".

    > <code> would be much more useful to show areas of plaintext which the
    > browser doesn't mark up.


    As mentioned previously, I often markup code that requires further markup
    within the section of code.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, May 2, 2006
    #19
  20. Ian Davies

    ironcorona Guest

    David Dorward wrote:
    > ironcorona wrote:
    >
    >> I disagree. What else, then, is the point of the <code> tag if not to
    >> be used to display the exact content of the tag

    >
    > To state that the data being marked up is code (and thus to allow the user
    > agent to inform the user of the fact).
    >
    >> Most of those old tags should be depreciated because you can you the
    >> "class" or "id" attribute to mark off specific areas, as per the ideal
    >> of separating style from content: using <span> or <div> in conjunction
    >> with CSS is just as useful.

    >
    > "This section is text is some code" is not "style".
    >
    >> <code> would be much more useful to show areas of plaintext which the
    >> browser doesn't mark up.

    >
    > As mentioned previously, I often markup code that requires further markup
    > within the section of code.


    Actually, I was coming back to delete that comment. I made a complete
    arse of the argument. I was infact, arguing the wrong thing. Please ignore.


    --
    ironcorona
    ironcorona, May 2, 2006
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    545
  2. Kevin Spencer

    Re: Simple Simple question!!!

    Kevin Spencer, Jun 25, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    647
    Kevin Spencer
    Jun 25, 2004
  3. Justin Rich
    Replies:
    2
    Views:
    397
    Justin Rich
    Jun 15, 2005
  4. Daniel Frey

    Simple Question - Simple Answer?

    Daniel Frey, Dec 28, 2004, in forum: XML
    Replies:
    4
    Views:
    825
    Daniel Frey
    Jan 12, 2005
  5. Wladimir Borsov
    Replies:
    4
    Views:
    284
    Tintin
    May 11, 2006
Loading...

Share This Page