Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 How to make a website/ Website building resources., Everything a webmaster needs.

views
     
MatQuasar
post Sep 26 2023, 04:56 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
Hello, as pointed in the screenshot..... How do highlight code snippet in HTML page? I see there is "pre" tag and "code" tag, can someone clarify?
And how to do Copy button when mouse hover the code snippet? What JavaScript?

user posted image
MatQuasar
post Oct 22 2023, 12:26 PM

Casual
***
Validating
329 posts

Joined: Jun 2023
QUOTE(defcon88 @ Oct 22 2023, 07:32 AM)
Not sure why this reply keep blocking me from giving you the code snippet code. I just send you the snapshot then

Highlighting Code Snippet in an HTML Page, you often use the <pre> and <code> tags in tandem. The <pre> tag defines preformatted text and is used to display text as it's written in the HTML source code. The <code> tag defines a piece of computer code and is often used inside the <pre> tag to preserve both whitespace and line breaks.

For example:

Refer to attahment

With this setup, a copy button will appear when you hover over the code snippet, and clicking the button will copy the code to your clipboard.

Regards,
Tuan Majlis
*
Wow, so simple after you showed me the code, you're expert. Will use this in my next website project.

 

Change to:
| Lo-Fi Version
0.0250sec    0.28    7 queries    GZIP Disabled
Time is now: 20th December 2025 - 10:09 PM