HTML Text Selection Style

Written by @kerixa 1 March 2021

Selecting a text in your website is important for those who want to adopt from the contents. So if you care about it, do not let this be very simple. With the following code, Selecting the texts with the mouse becomes stylish and more attractive. Enjoy!

Code Snippet:

                                                
                                                <!-- this script is provided by https://www.htmlfreecode.com coded by: Kerixa Inc. -->
<style>
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,800);

body {
    font-family: 'Open Sans';
    padding: 2em;
}

h1 {
    color: #444;
    font: 800 350%/1.4 'Open Sans', sans-serif;
    text-transform: uppercase;
}

h1::selection {
	-webkit-text-stroke: 4px #fb8a05;
	color: transparent;
}

a {
    color: #fb8a05;
    text-decoration: none;
}

a:hover {
	color: #532600;
}
</style>
<h1>Nice selection</h1>
<p>Highlight the heading and let's see how this works as well.</p>
<font face="Tahoma"><a target="_blank" href="http://www.htmlfreecode.com/"><span style="font-size: 8pt; text-decoration: none">HTML Free Code</span></a></font>
<a target='_blank' href='https://www.htmlfreecode.com' style='font-size: 8pt; text-decoration: none'>Html Free Codes</a>                                                
                                            

Example:


About @kerixa

I am Krishna Eydat. I studied Software Engineering at University of Waterloo in Canada. I lead a few tech companies. I am passionate about the way we are connected. I would like to be part of something big or be the big deal!

K

Comments


Here you can leave us commments. Let us know what you think about this code tutorial!

0 / 300

TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members: carfaoui, Ali7hry, alexnicola, Adam20, Prashanthcs11
advertisement 2