CSS Pre Code Warna-warni Tanpa JavaScript

Agar baris kode yang saya masukkan di artikel Blogger terlihat berbeda, saya menerapkan CSS Pre Code warna-warni.

CSS Pre Code Warna-warni Tanpa JavaScript
Kadang-kadang saya merasa perlu memasukkan baris-baris kode dalam artikel. Agar baris kode yang saya masukkan di artikel Blogger terlihat berbeda, saya menerapkan CSS Pre Code. Ini adalah contoh dengan latar belakang hitam dalam tulisan warna-warni yang saya ambil dari Codepen.

Bagaimana Menerapkan CSS Pre Code untuk Blogger?

CSS yang digunakan:

/* CSS Simple Pre Code */
pre {
    background: #333;
    white-space: pre;
    word-wrap: break-word;
    overflow: auto;
}

pre.code {
    margin: 20px 25px;
    border-radius: 4px;
    border: 1px solid #292929;
    position: relative;
}

pre.code label {
    font-family: sans-serif;
    font-weight: bold;
    font-size: 13px;
    color: #ddd;
    position: absolute;
    left: 1px;
    top: 15px;
    text-align: center;
    width: 60px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: none;
}

pre.code code {
    font-family: Courier,monospace;
    display: block;
    margin: 0 0 0 60px;
    padding: 15px 16px 14px;
    border-left: 1px solid #555;
    overflow-x: auto;
    font-size: 13px;
    line-height: 19px;
    color: #ddd;
}

pre::after {
    content: "double click to selection";
    padding: 0;
    width: auto;
    height: auto;
    position: absolute;
    right: 18px;
    top: 14px;
    font-size: 12px;
    color: #ddd;
    line-height: 20px;
    overflow: hidden;
    -webkit-backface-visibility: hidden;
    transition: all 0.3s ease;
}

pre:hover::after {
    opacity: 0;
    visibility: visible;
}

pre.code-css code {
    color: #91a7ff;
}

pre.code-html code {
    color: #aed581;
}

pre.code-javascript code {
    color: #ffa726;
}

pre.code-jquery code {
    color: #4dd0e1;
}

Bagaimana cara menulisnya di artikel?

Untuk HTML

<pre class='code code-html'><label>HTML</label><code>
Letakkan kode HTML di sini
</code></pre>
atau untuk CSS

<pre class='code code-css'><label>CSS</label><code>
Letakkan kode CSS di sini
</code></pre>
atau untuk JavaScript

<pre class='code code-javascript'><label>JS</label><code>
Letakkan kode JavaScript di sini
</code></pre>
atau untuk jQuery

<pre class='code code-jquery'><label>JQuery</label><code>
Letakkan kode JQuery di sini
</code></pre>
Selamat mencoba menerapkan CSS Pre Code untuk Blogger. Catatan: Agar klik ganda berfungsi untuk memilih semua kode ("double click to selection"), mau tidak mau Anda harus menambahkan JavaScript.

COMMENTS

BLOGGER: 2
  1. Dan tidak bisa juga akhirnya mengelak javascript😁

    ReplyDelete
  2. If you're attempting to lose weight then you absolutely need to start using this brand new tailor-made keto diet.

    To create this service, certified nutritionists, personal trainers, and chefs united to provide keto meal plans that are effective, suitable, economically-efficient, and delicious.

    From their launch in early 2019, 1000's of people have already transformed their body and health with the benefits a great keto diet can give.

    Speaking of benefits; in this link, you'll discover eight scientifically-proven ones offered by the keto diet.

    ReplyDelete

Name

Adsense,2,Blockquote,1,Blogger,17,Blogger Tool,1,Blogspot,1,Contact Form,3,CSS,23,CSS3,1,Domain,1,Font,2,Halaman,3,HTML,5,JavaScript,17,jQuery,6,Komentar,2,Page Loading,1,SEO,1,Share Button,1,Sidebar,1,Tag Kondisional,1,Tema,11,Trik,1,Website,1,WordPress,2,
ltr
item
Jelas in Blog: CSS Pre Code Warna-warni Tanpa JavaScript
CSS Pre Code Warna-warni Tanpa JavaScript
Agar baris kode yang saya masukkan di artikel Blogger terlihat berbeda, saya menerapkan CSS Pre Code warna-warni.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs0IqcQQ6PuGpZ7LygJczPiQS1EyJToUYHuiQLQEi_2j9zdTbffNF92uYQz8fWBtJeaDqm7vJ1_VRpL_cP-u8i2SPqZAfdkByIbOs-EjpQ2Jyi4f7I4qZNfDRK-A-knNZsDopTlv_CcmY/s1600/CSS+Pre+Code+untuk+Blogger.PNG
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs0IqcQQ6PuGpZ7LygJczPiQS1EyJToUYHuiQLQEi_2j9zdTbffNF92uYQz8fWBtJeaDqm7vJ1_VRpL_cP-u8i2SPqZAfdkByIbOs-EjpQ2Jyi4f7I4qZNfDRK-A-knNZsDopTlv_CcmY/s72-c/CSS+Pre+Code+untuk+Blogger.PNG
Jelas in Blog
https://jelasinblog.blogspot.com/2018/11/css-pre-code-warna-warni-latar-hitam.html
https://jelasinblog.blogspot.com/
https://jelasinblog.blogspot.com/
https://jelasinblog.blogspot.com/2018/11/css-pre-code-warna-warni-latar-hitam.html
true
2350744749749285503
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content