Html effects for text

CSS Text Effects

CSS Text Overflow, Word Wrap, Line Breaking Rules, and Writing Modes

In this chapter you will learn about the following properties:

CSS Text Overflow

The CSS text-overflow property specifies how overflowed content that is not displayed should be signaled to the user.

This is some long text that will not fit in the box

or it can be rendered as an ellipsis (. ):

This is some long text that will not fit in the box

The CSS code is as follows:

Example

p.test1 <
white-space: nowrap;
width: 200px;
border: 1px solid #000000;
overflow: hidden;
text-overflow: clip;
>

p.test2 white-space: nowrap;
width: 200px;
border: 1px solid #000000;
overflow: hidden;
text-overflow: ellipsis;
>

The following example shows how you can display the overflowed content when hovering over the element:

Example

CSS Word Wrapping

The CSS word-wrap property allows long words to be able to be broken and wrap onto the next line.

If a word is too long to fit within an area, it expands outside:

This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.

The word-wrap property allows you to force the text to wrap — even if it means splitting it in the middle of a word:

This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword. The long word will break and wrap to the next line.

The CSS code is as follows:

Example

Allow long words to be able to be broken and wrap onto the next line:

CSS Word Breaking

The CSS word-break property specifies line breaking rules.

This paragraph contains some text. This line will-break-at-hyphens.

This paragraph contains some text. The lines will break at any character.

The CSS code is as follows:

Example

p.test2 word-break: break-all;
>

CSS Writing Mode

The CSS writing-mode property specifies whether lines of text are laid out horizontally or vertically.

Читайте также:  Анонимный блок

Some text with a span element with a vertical-rl writing-mode.

The following example shows some different writing modes:

Example

p.test1 <
writing-mode: horizontal-tb;
>

span.test2 writing-mode: vertical-rl;
>

p.test2 writing-mode: vertical-rl;
>

CSS Text Effect Properties

The following table lists the CSS text effect properties:

Property Description
text-justify Specifies how justified text should be aligned and spaced
text-overflow Specifies how overflowed content that is not displayed should be signaled to the user
word-break Specifies line breaking rules for non-CJK scripts
word-wrap Allows long words to be able to be broken and wrap onto the next line
writing-mode Specifies whether lines of text are laid out horizontally or vertically

Источник

15 Gorgeous CSS Text Animation Effects [Examples]

One important factor of website design is the font choice and the style of typography that you select. This can easily be a make or break situation. Fonts catch the eye very quickly and can engage the user or push them away, so it’s important to make the right choice.

However, fonts and typography don’t have to be static. You can introduce CSS text effects on your website to help you stand out. Things such as scrolling text, shadows, text glow, style, colour, 3D effect and many more.

On this article we’ll be focusing on CSS Text Animations. These are simple and easy to integrate into your design, with pure HTML, CSS and (in some of them) some JavaScript. You can use them on scrolling animation websites.

15 Amazing Text Animations with CSS

These CSS text animations can be used to make your webpage more interesting and give it a unique design and feel. You have to be careful though, not all of these CSS text effects will benefit every design. For example, with a minimalistic design, you may want to choose a more subtle effect (just check these Minimalist WordPress themes by yourself and you will easily find out that they could ruin their clean design)

However, there should be a design in here that fits every user’s needs and expectations to improve your design and look. Check out these 15 text animation CSS codepens that we have selected for you.

1. Scroll Trigger Text Animation

A great example of how you can take advantage of CSS text animation which is triggered by a user scrolling. This one uses a trigger both for scrolling up and down, so the animation will always work in any direction.
Scroll-triggered animations are perfect for one-page websites.

If you do not know how to create a one-page website, fullPage.js library will make it easy for you. You can even use it in WordPress builders like Elementor and Gutenberg.

And if you are looking for scroll trigger animations, this article on How to Create CSS Animations on Scroll might be very helpful for you.

Читайте также:  Python finding duplicates in list

2. Text Colour Animation Effect (CSS only)

This one is just pure HTML and CSS, so it will be very easy to use and does not require any JavaScript. It sends a colourful transition of different colours across the text using a gradient, giving a very modern look.

You can easily change the chosen colours to fit your own brand by altering the hex codes in the CSS.

3. Static CSS Colour Change

Great for a big title, this one changes the colour of each word without any transition. This CSS text effect can be useful if you have a minimalistic design and don’t want things to look too busy.

Made purely with HTML and CSS, you can easily change the colours and speed of the animation. Just try it yourself by modifying the CSS of the codepen.

4. Morphing CSS Text Effect

A more advanced animation which is made with pure HTML, CSS and JavaScript. As you can see in the text animation CSS codepen, you can make more advanced animations when you add a little JavaScript. However, this one is still relatively easy to edit and mould to your brand or style.

5. Bouncing With Reflection Text Animation (CSS only)

A bouncing CSS text effect that has a reflection, made with only HTML and CSS, making it very portable across different websites.

It uses a span HTML element to position each letter in a row and bounces each one during the text animation, so be careful where you place it.

6. Water Wave Text Animation (CSS only)

A calm water CSS text effect, it animates the effect of a calm wave within the text. Great for a range of different titles on a website, could really make it stand out.

This one only uses HTML and CSS, making it easy to work with.

7. Crossing On Scroll CSS Text Effect

If you are looking for something to trigger a text animation, an on-scroll animation like this one may be of use to you. It uses HTML, CSS and JavaScript to pull this off. The animation is light and very smooth. Scrolling the letters individually could also add more value to this CSS text effect.

8. Loading Style CSS Text Animation

Looks like a loading progress bar but in the form of a font. Change the text to anything you want and use this unique animation. You can easily change the colours of the text animation in the CSS codepen.

9. Flip Text Animation (CSS only)

Can be used as a loading animation when waiting for a response on a webpage, made with only HTML and CSS. The text flips over from left to right and is a very smooth animation.

10. Fade In Text Animation (CSS only)

A subtle text animation (CSS) that fades in when the page loads. Very smooth animation and has a subtle blur effect upon fading in. Made with pure HTML and CSS.

Читайте также:  How to create url in java

11. 3D Text Grow Animation

Text animation (CSS) with a 3D effect that grows up and down. A very fun and engaging animation to use.

12. Animated Blobs Text animation (CSS only)

A very subtle CSS text animation with a colourful background and engaging font type. Made with pure HTML and CSS, it is easy to change colours and font type to fit your brand and style.

13. Basic Text Animations (CSS only)

If you are looking for some basic reusable text animations (pure CSS) that can be quickly used in many places on a webpage, these ones are for you. Made with only HTML and CSS, they are easy to edit and learn from.

A catchy and engaging CSS text animation great for the main title on a webpage. It loops through different words and has a sliding animation effect to transition between each word. Made with pure HTML and CSS, so it is easy to work with and edit.

15. Typing Text Animation

A great way to showcase a range of words or sentences across a screen in one area. The typing CSS text effect looks great for many designs and uses a smooth animation. Made with HTML, CSS and JavaScript but a great one to learn from and it is easy to edit the words you need to use.

Conclusion

CSS Text animations are great, they help create an inviting space for the visitors and help catch the eye towards a certain location. They can suit very well in one-page websites with full screen sections, creating a very appealing design for the user. I’m thinking about product landing websites, squeeze pages, etc.

FullPage.js library is the perfect tool to create this kind of fullscreen website. It is available for WordPress builders like Elementor and Gutenberg. Add one of these CSS text animations in fullscreen mode and I’m sure the result will be promising. For example, as we explained in the 1st CSS text animation, the scroll-triggered animation fits very well in a one-page website with multiple sections.

It can be difficult to choose the right animation though, not all animations will work well on all designs, so be sure to ask yourself if the animation is too busy and maybe opt for a more subtle one. Don’t overuse CSS text effects either, it will make the page look tacky and overrun with animations.

Luke Embrey is a full-stack developer, BSc in Computer Science and based in the UK.
You can find out more about him at https://lukeembrey.com/

Join 2,000+ readers and learn something new every month!

Источник

Оцените статью