Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

XHTML - create my own elements?

Options
  • 13-07-2007 2:15pm
    #1
    Registered Users 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 Posts: 26,579 ✭✭✭✭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 Posts: 2,364 ✭✭✭Mr. Flibble


    Ah, right. Cheers.


  • Registered Users 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 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 Posts: 11,980 ✭✭✭✭Giblet


    Use XML and a dtd to make your own elements.


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


    what you said

    my head


  • Registered Users Posts: 21,257 ✭✭✭✭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 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