Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

XHTML - create my own elements?

  • 13-07-2007 02:15PM
    #1
    Registered Users, Registered Users 2 Posts: 2,364 ✭✭✭


    Can you have your own elements in XHTML?

    Say I make up a tag <mytag> so I can easily modify its properties using CSS, do I have to tell the XHTML somewhere that I've made this tag, or is it just not allowed?


Comments

  • Registered Users, Registered Users 2 Posts: 26,449 ✭✭✭✭Creamy Goodness


    what you're looking for would be classes in css.

    xHTML doesn't allow the making up of your own tags.


  • Registered Users, Registered Users 2 Posts: 2,364 ✭✭✭Mr. Flibble


    Ah, right. Cheers.


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    Best give a <div> tag an id and then in css, you can use #whateveridis to modify it's properties. Similar to classes but id's are unique to one element and classes can be applied to multiple elements on the one page.

    Rgds, Dave


  • Registered Users, Registered Users 2 Posts: 2,364 ✭✭✭Mr. Flibble


    I want to control the style of a number of elements (for questions and answers in FAQ here) so using class is best right?

    While we are all here, can somone verify the following for me.
    - one or more elements can have the same class name but only one element can have a particular ID?

    - to access an ID in css you use #theid and to access a class you use .theclass?

    - and to only specify particular id classes you would do #theid theid2 or #theid theclass2 for IDs and theclass.theid or theclass.theclass2 ?
    So a space for IDs and a . for classes?


  • Registered Users, Registered Users 2 Posts: 12,025 ✭✭✭✭Giblet


    Use XML and a dtd to make your own elements.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,364 ✭✭✭Mr. Flibble


    what you said

    my head


  • Registered Users, Registered Users 2 Posts: 21,278 ✭✭✭✭Eoin


    For the FAQ section, you could use something like this:

    [html]
    <style type="text/css">
    dt
    {
    /* same definitions as your question class */
    }

    dd
    {
    /* same definitions as your answer class */
    }
    </style>

    <dl>
    <dt>Your question here</dt>
    <dd>Your Answer here</dd>
    <dt>Another question here</dt>
    <dd>Another Answer here</dd>
    </dl>
    [/html]

    I think this might make better / more semantic markup as it associates a question with an answer, while using <li> tags doesn't.


  • Registered Users, Registered Users 2 Posts: 2,364 ✭✭✭Mr. Flibble


    Ok, I tried to do that. Can I put lists inside the answers tho? I seem to get errors when I do.


Advertisement