Copied to clipboard

Flag this post as spam?

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


  • ABHISHEK KUMAR 13 posts 103 karma points
    Dec 28, 2015 @ 11:03
    ABHISHEK KUMAR
    0

    Style in Tiny Mce

    Hi Everyone,

    In Tiny Mce Editor I need to write a style which will 1.> Apply on a part of the line. 2.> Will wrap the selected part in ... tag.

    The style em {em} is being applied on the whole paragraph. Which doesnt fullfill 1st createria.

    Same I need to do with the q tag. I nned to select some part of line and put it inside "..... " quotation. If I write q{q} it is applied on the whole paragraph instead of selected part of paragraph.

    Thanks

    Abhishek

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Dec 28, 2015 @ 12:51
    Stefan Kip
    0

    The only thing I read is "I need" instead of asking a question. It might help if you ask a real question and describe what you've already tried.

  • Charles Afford 1163 posts 1709 karma points
    Dec 30, 2015 @ 20:44
    Charles Afford
    0

    Can you not do this in the tiny mce by selected the text and then selecting the style from the dropdown menu? You used to be able to? I am probably muissing something here :)

  • Robert Foster 440 posts 1684 karma points MVP admin c-trib
    Dec 31, 2015 @ 03:51
    Robert Foster
    101

    Styles in the Rich Text editor are limited - you can either define a style on a generic tag (H1, H2, P etc.) or as a named class which will wrap whatever you have highlighted in a span with the class name applied.

    Examples:

    If I have a class named .quote I can do this:

    /**umb_name:Quote*/
    .quote {
        font-weight: bold;
    }
    
    .quote:after {     
        content: '\201D';
    }
    
    .quote:before {
        content: '\201C';
    }
    

    Then when I apply the style to a selected word or words (highlighted below) in a paragraph like so:

    The quick fox jumped over the lazy dog

    the html becomes

    <p>The quick fox <span class="quote">jumped over the</span> lazy dog</p>
    

    and should in theory be rendered something like this:

    The quick fox "jumped over the" lazy dog
    

    You can also create styles that change the element of a block of text by specifying the element as the selector like so:

    /**umb_name:Heading 1*/
    H2 {
    }
    
    /**umb_name:Heading 2*/
    H3 {
    }
    
    /**umb_name:Body Text*/
    p {
    }
    

    If you then click on a paragraph and choose the "Heading 1" style from the drop down the paragraph will be converted to a H2 with the default styling.

    It's worth noting that not all tags can be converted or have classes applied - img tags for example are ignored.

    Hopefully this helps clarify things...

  • ABHISHEK KUMAR 13 posts 103 karma points
    Jan 04, 2016 @ 06:12
    ABHISHEK KUMAR
    0

    Hi Robert Foster,

    Thanks I too figure out the same thing that you have given as solution. As when I were writing styles for h1 and earlier style with tag h1 and since h1 is a block css element it was being applied on whole paragraph, so I wrote a class for it with the class name h1, and it is being applied on the selected part as span tag. So I am using ... . Your answer will help me to justify the way I used for the solution. :)

    Thanks,

    Abhishek Kumar

  • 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