In this article, we will take a look at:
- You may need to specify a character, a word or an entire sentence in order to fulfill a requirement for website design.half-style. You will need some CSS or JavaScript to do this.
- Let’s learn how to do it!with CSSIt is below.
- This article will demonstrate how to create a character, a word, or a whole sentence using 4 methods.half-style.
Transparent half-style
<!DOCTYPE html> <html> <head> <style>.demo {float: left;width: 100%;text-align: center;background:#f2f2f2;} h1 {display: inline-block; margin: 0; line-height: 1em; font-family: Helvetica, Arial, sans-serif;font-weight: bold;font-size: 200px; background: linear-gradient(to right, #b9557b 50%, transparent 50%);background-clip: text; -webkit-background-clip: text;-webkit-text-fill-color: transparent; } </style> </head> <body> <div class="demo"> <h1>X</h1> </div> </body> </html>
<!DOCTYPE html> <html> <head> <style> .demo {float: left;width: 100%;text-align: center;background:#f2f2f2;} h1 {display: inline-block; margin: 0; line-height: 1em; font-family: Helvetica, Arial, sans-serif;font-weight: bold;font-size: 200px; background: linear-gradient(to right, #b9557b 50%, transparent 50%);background-clip: text; -webkit-background-clip: text;-webkit-text-fill-color: transparent; } </style> </head> <body> <div class="demo"> <h1>X</h1> </div> </body> </html>
<!DOCTYPE html> <html> <head> <style> .demo {float: left;width: 100%;text-align: center;background:#f2f2f2;} h1 {display: inline-block; margin: 0; line-height: 1em; font-family: Helvetica, Arial, sans-serif;font-weight: bold;font-size: 200px; background: linear-gradient(to right, #b9557b 50%, transparent 50%);background-clip: text; -webkit-background-clip: text;-webkit-text-fill-color: transparent; } </style> </head> <body> <div class="demo"> <h1>X</h1> </div> </body> </html>
Output:
Character with half-style
<!DOCTYPE html> <html> <head> <style> demo {float: left;width: 100%;text-align: center;background:#f2f2f2; h1 {display: inline-block;margin: 0;line-height: 1em; font-family: Helvetica, Arial, sans-serif;font-weight: bold;font-size: 200px;background: linear-gradient(to right, #b9557b 50%, #1c43a0 50%);background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;} </style> </head> <body> <div class="demo" <h1>X</h1> </div> </body> </html>
<!DOCTYPE html> <html> <head> <style> .demo {float: left;width: 100%;text-align: center;background:#f2f2f2;} h1 {display: inline-block;margin: 0;line-height: 1em; font-family: Helvetica, Arial, sans-serif;font-weight: bold;font-size: 200px;background: linear-gradient(to right, #b9557b 50%, #1c43a0 50%);background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;} </style> </head> <body> <div class="demo"> <h1>X</h1> </div> </body> </html>
Output :
Full Word Style
<!DOCTYPE html> <html> <head> <style> .demo {float: left;width: 100%;text-align: center;background:#f2f2f2;} span {display: inline-block;margin: 0;line-height: 1em; font-family: Helvetica, Arial, sans-serif;font-weight: bold;font-size: 60px;background: linear-gradient(to right, #1c43a0 50%,#b9557b 50%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;} </style> </head> <body> <div class="demo"> <div> <span>T</span> <span>E</span> <span>X</span> <span>T</span> </div> </div> </body> </html>
<!DOCTYPE html> <html> <head> <style> .demo {float: left;width: 100%;text-align: center;background:#f2f2f2;} span {display: inline-block;margin: 0;line-height: 1em; font-family: Helvetica, Arial, sans-serif;font-weight: bold;font-size: 60px;background: linear-gradient(to right, #1c43a0 50%,#b9557b 50%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;} </style> </head> <body> <div class="demo"> <div> <span>T</span> <span>E</span> <span>X</span> <span>T</span> </div> </div> </body> </html>
Output :
Horizontally half-styled letter
<!DOCTYPE html> <html> <head> <style> .demo {float: left;width: 100%;text-align: center;background:#f2f2f2;} .horizontal {display: inline-block;margin: 0;line-height: 1em; font-family: Helvetica, Arial, sans-serif;font-weight: bold;font-size: 60px;background: linear-gradient(to top, #1c43a0 50%,#b9557b 50%);-webkit-background-clip: text;-webkit-text-fill-color: transparent;} </style> </head> <body> <div class="demo"><div> <span class="horizontal">X</span> </div> </div> </body> </html>
Output :