How-to articles, tricks, and solutions about TEXT

How to Disable Text Selection, Copy, Cut, Paste and Right-click on a Web Page

Learn the ways of how to disable text selection highlighting, how to disable copy, cut and paste, how to disable right-click. See example with CSS, JavaScript and jQuery.

How to Find All Files Containing Specific Text on Linux

Learn How to Find All Files Containing Specific Text on Linux with W3docs tutorial. Also, try the examples yourself and see the results.

How to Flip Text with CSS

CSS3 allows us to have various effects, including text flipping due to transformation functions. See examples of upside down, horizontal and vertical flipping.

How to Give a Text or Image a Transparent Background Using CSS

Use CSS3 opacity property to make an image or a background transparent. Learn also how to change the opacity while hovering. All with examples.

How to Increase the Space Between Text and Underlining in CSS

Although CSS does not provide many options for the underlines below texts, there are some ways to do this. Read our snippet and find out the solutions.

How to Limit the Text Length to One Line with CSS

In this snippet, you can find out how to limit the text length to one line by clipping the line, adding an ellipsis or strings. Use the text-overflow property.

How to Make the Text Bold in HTML

In this snippet, you’ll see how to make the text bold by using the <strong> or <b> tags. Also, you can use the CSS font-weight property in the HTML part.

How to Make the Text Input Non-Editable

In this snippet, you can find two methods of making a text input non-editable. Use either the HTML “readonly” attribute or add the CSS pointer-events property.

How to print color in console using System.out.println?

To print colored text to the console using System.out.println, you will need to use special escape sequences in your string to specify the desired color.

How to read a text file into a list or an array with Python

One way to read a text file into a list or an array with Python is to use the split() method.

How to Remove and Style the Border Around Text Input Boxes in Google Chrome

Use outline: none to remove the ugly border color for a form field in Chrome. Learn also how to give your own style for showing that the box is active. All with examples.

How to Render an HTML String Preserving Spaces and Line Breaks

In this tutorial, you can learn how to render an HTML text preserving spaces and line breaks. You need to use the HTML <pre> tag or the CSS white-space property.

How to search text using php if ($text contains "World")

You can use the strpos() function in PHP to search for a specific string within another string.

How to Select All Text in HTML Text Input When Clicked Using JavaScript

Read the tutorial and learn the two methods of selecting the entire text in HTML text input when clicked using JavaScript code snippets. Also, see examples.

How to Stretch a Text with CSS

In this snippet, we’ll show how to stretch a text horizontally or vertically using CSS. For that, you can use the CSS transform property set to the “scale”.

How to Truncate Multi-Line String with Pure CSS

It's a common problem to truncate a multi-line string. In this snippet, we'll show how to do it with CSS properties. You can also use CSS pseudo-elements.

How to Vertically Align a Text Next to the Image

A common question is how to align text next to an image vertically? Read this snippet and learn to do it step by step, as well as try different examples.

How to Vertically Center Text with CSS

To position text vertically positioned with CSS you can use vertical-align, line-height, transform properties, flexbox. Learn more methods. Try examples.

How to Wrap a Long String Without any Whitespace Character

In this snippet, we’ll demonstrate how to wrap a long string without any whitespace character. Use the CSS word-wrap property with the “break-word” value.

How to Wrap Text in a <pre> Tag with CSS

The <pre> tag inserts a preformatted text into an HTML document. Since the <pre> tag doesn’t support wrapping, we’ll show how to do it with the help of CSS.

Input Types for HTML Forms

Learn about mostly usedLearn about mostly used input types which are used when creating HTML Forms. See Syntax and examples. input types which are used when creating HTML Forms. See Syntax and examples.

Print string to text file

In Python, you can use the built-in open() function to create a text file and write a string to it.

Reading a plain text file in Java

This code opens the file "filename.txt" and reads it line by line. Each line is printed to the console until the end of the file is reached.

Shadow Effects in CSS

Use text-shadow and box-shadow CSS properties for shadow effects in CSS. See how to have amazing effects for texts, borders and boxes.

What is the Difference Between <b> and <strong>, <i> and <em> Tags

In this snippet, we’re going to explain the differences between the <b> and <strong>, <i> and <em> tags. Find out the differences and use them correctly.

1 2