The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
3 posters

    About code boxes

    Winging
    Winging
    Forumember


    Female Posts : 149
    Reputation : 4
    Language : traditional chinese

    Solved About code boxes

    Post by Winging April 18th 2023, 9:56 am

    Forum version : #ModernBB
    Position : Founder
    Concerned browser(s) : Google Chrome
    Who the problem concerns : Yourself
    Forum link :https://ekin-ek.666forum.com
    - - - - - - - -
    Hello!

    I changed my code box style,and found small problems.
    I don't want gray blocks.
    And 【< >】appearing on the far right, some words that block the top.

    About code boxes Ee10

    I want to be able to be clean like the picture (no overlap)
    About code boxes Ee11


    And My code

    In CSS:
    Code:
    /* codebox 代碼框 */
    .codebox dd {
      background-color: #cdfaf5;
      border-radius: 3px;
    }
    .codebox dt {
      background-color: #73d9ce;
      border-radius: 3px;
    }
    .selectCode { float:right; text-transform: uppercase; cursor:pointer;
    }
    div.cont_code { clear: right;
    }

    In Javascript ( In all the pages):
    Code:
    function selectCode(e) {
            var doc = document
                , text = $(e).closest("dl").find(".cont_code,code").get(0)
                , range, selection
            ;
            if (doc.body.createTextRange) {
                range = document.body.createTextRange();
                range.moveToElementText(text);
                range.select();
            } else if (window.getSelection) {
                selection = window.getSelection();       
                range = document.createRange();
                range.selectNodeContents(text);
                selection.removeAllRanges();
                selection.addRange(range);
            }
        };
        $(function(){$("dl.codebox:not(.spoiler,.hidecode)  > dd.code, dl.codebox:not(.spoiler,.hidecode)  > dd > code").closest("dl").find('dt').append('<span onClick="selectCode(this)" class="selectCode">選擇內容</span>')});


    Thanks in advance for your help!


    Last edited by Winging on April 18th 2023, 10:16 am; edited 1 time in total
    Razor12345
    Razor12345
    Support Moderator
    Support Moderator


    Male Posts : 1575
    Reputation : 266
    Language : Ukr, Rus, Eng
    Location : Ukraine

    Solved Re: About code boxes

    Post by Razor12345 April 18th 2023, 10:03 am

    Good afternoon!

    AP - Display - Colors&CSS - Stylesheet CSS

    Try this code:

    Code:
    dl.codebox {
      background-color: transparent;
      border-color: transparent;
    }

    dl.codebox:before {
      display: none;
    }

    Result:

    About code boxes Scree105


    Last edited by Razor12345 on April 18th 2023, 10:09 am; edited 1 time in total (Reason for editing : Correct code)

    SarkZKalie and Winging like this post

    Winging
    Winging
    Forumember


    Female Posts : 149
    Reputation : 4
    Language : traditional chinese

    Solved Re: About code boxes

    Post by Winging April 18th 2023, 10:10 am

    thank you @Razor12345

    oh yes it works!it gets very clean!

    About code boxes Eeaa11

    Thank you very much! About code boxes 1f60a
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19325
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: About code boxes

    Post by Ape April 18th 2023, 3:27 pm

    Thank you for your help @Razor12345
    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules



    About code boxes Left1212About code boxes Center11About code boxes Right112
    About code boxes Ape_b110
    About code boxes Ape1010

    Razor12345 likes this post


      Current date/time is September 23rd 2024, 12:38 am