Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • IanS 22 posts 65 karma points
    Jun 11, 2014 @ 16:19
    IanS
    0

    RTE - How to have multiple h2 tags?

    I'm trying to add custom formats to TinyMCE but can't figure this out:

    My site has 2 different h2's on it, each slightly different. In Umbraco 7 I can create the style for the default h2 but how can I create more than 1?

    My css on the front end is like:

    h2 { standard h2 rules here }

    h2.other { different rules }

    I can create a css rule that makes it look like the "other" one, but it renders it as a span whereas I want it rendered as either:

    < h2 >blah

    or

    < h2 class="other" >

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Jun 20, 2014 @ 19:14
    Jan Skovgaard
    0

    Hi IanS and welcome to our :)

    Why do the two <h2> headers need different styling? And how do they differ? Is it by color, size or something else?

    Looking forward to hearing from you.

    /Jan

  • IanS 22 posts 65 karma points
    Jun 23, 2014 @ 15:39
    IanS
    0

    Hi Jan,

    It's by color yes.

  • Robert Foster 440 posts 1684 karma points MVP admin c-trib
    Jun 23, 2014 @ 20:04
    Robert Foster
    2

    Hi Ian,

    Currently you can create a Stylesheet Property to format a text selection as a H2, or apply a class to it (e.g. .redHeader) but not both unfortunately.  For some reason the RTE insists on applying class-based styles to span elements and won't allow Stylesheet Properties that have an alias combining an element and a class to be applied.

    For example, you could do this:

    Property 1
    Alias: H2

    Property 2:
    Alias: .redHeader

    Both of the above are valid, the following is not:

    Property 3:
    Alias: H2.redHeader

    Having said that, you can apply both rules to the Heading to achieve the desired result; almost.  By applying both Property 1 and Property 2 to the same element, I get the following HTML:

    Heading 1

     

    Hope this helps...

    Rob.

    Edit: It looks like you've already figured that one out... In thinking about it, it looks to me like it may be a shortcoming of the Umbraco RTE style plugin - perhaps it should be reported as a feature request in the issue tracker...

  • IanS 22 posts 65 karma points
    Jun 25, 2014 @ 10:59
    IanS
    0

    Thanks a lot for the help Rob, it's been driving me up the wall!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies