Creative Text Styling with the CSS mix-blend-mode Property

Create enticing graphics with the CSS mix-blend-mode property which erases the need for tools like Photoshop.

mix-blend-mode is a CSS property that defines how the content of an element should blend with the content of the element’s parent and its background. With this, you can create nice blends and colors for parts of an element’s content depending on its direct background.

mix-blend-mode gives CSS developers greater flexibility to create native designs using real text on images, thereby removing the need to use often bloated images edited with tools like Photoshop.

One big advantage that gives us is better performance, as fewer images would be needed and file sizes would be significantly smaller. On top of that, using photoshopped images doesn’t provide the same SEO benefits that real text provides you.

Yet another important benefit of using mix-blend-mode as opposed to edited image alternatives is that you can use CSS animations, affording you the chance to add more life to your website and elements. Other practical use cases for mix-blend-mode include removing white background from logos and making dynamic text contrast whatever background it is on.

How mix-blend-mode works in a nutshell

mix-blend-mode creates what is known as stacking context. Stacking context is an imaginary z-axis relative to the user facing the viewport where the HTML elements reside. They occupy this space based on elements’ priorities. This is the same idea that the position CSS property uses, too.

mix-blend-mode applies to all elements, including SVGs, though this is not yet available on all browsers at the time of writing.

#css #web-development #programming

What is GEEK

Buddha Community

Creative Text Styling with the CSS mix-blend-mode Property

Navigating Between DOM Nodes in JavaScript

In the previous chapters you've learnt how to select individual elements on a web page. But there are many occasions where you need to access a child, parent or ancestor element. See the JavaScript DOM nodes chapter to understand the logical relationships between the nodes in a DOM tree.

DOM node provides several properties and methods that allow you to navigate or traverse through the tree structure of the DOM and make changes very easily. In the following section we will learn how to navigate up, down, and sideways in the DOM tree using JavaScript.

Accessing the Child Nodes

You can use the firstChild and lastChild properties of the DOM node to access the first and last direct child node of a node, respectively. If the node doesn't have any child element, it returns null.

Example

<div id="main">
    <h1 id="title">My Heading</h1>
    <p id="hint"><span>This is some text.</span></p>
</div>

<script>
var main = document.getElementById("main");
console.log(main.firstChild.nodeName); // Prints: #text

var hint = document.getElementById("hint");
console.log(hint.firstChild.nodeName); // Prints: SPAN
</script>

Note: The nodeName is a read-only property that returns the name of the current node as a string. For example, it returns the tag name for element node, #text for text node, #comment for comment node, #document for document node, and so on.

If you notice the above example, the nodeName of the first-child node of the main DIV element returns #text instead of H1. Because, whitespace such as spaces, tabs, newlines, etc. are valid characters and they form #text nodes and become a part of the DOM tree. Therefore, since the <div> tag contains a newline before the <h1> tag, so it will create a #text node.

To avoid the issue with firstChild and lastChild returning #text or #comment nodes, you could alternatively use the firstElementChild and lastElementChild properties to return only the first and last element node, respectively. But, it will not work in IE 9 and earlier.

Example

<div id="main">
    <h1 id="title">My Heading</h1>
    <p id="hint"><span>This is some text.</span></p>
</div>

<script>
var main = document.getElementById("main");
alert(main.firstElementChild.nodeName); // Outputs: H1
main.firstElementChild.style.color = "red";

var hint = document.getElementById("hint");
alert(hint.firstElementChild.nodeName); // Outputs: SPAN
hint.firstElementChild.style.color = "blue";
</script>

Similarly, you can use the childNodes property to access all child nodes of a given element, where the first child node is assigned index 0. Here's an example:

Example

<div id="main">
    <h1 id="title">My Heading</h1>
    <p id="hint"><span>This is some text.</span></p>
</div>

<script>
var main = document.getElementById("main");

// First check that the element has child nodes 
if(main.hasChildNodes()) {
    var nodes = main.childNodes;
    
    // Loop through node list and display node name
    for(var i = 0; i < nodes.length; i++) {
        alert(nodes[i].nodeName);
    }
}
</script>

The childNodes returns all child nodes, including non-element nodes like text and comment nodes. To get a collection of only elements, use children property instead.

Example

<div id="main">
    <h1 id="title">My Heading</h1>
    <p id="hint"><span>This is some text.</span></p>
</div>

<script>
var main = document.getElementById("main");

// First check that the element has child nodes 
if(main.hasChildNodes()) {
    var nodes = main.children;
    
    // Loop through node list and display node name
    for(var i = 0; i < nodes.length; i++) {
        alert(nodes[i].nodeName);
    }
}
</script>

#javascript 

Creative CSS Mix Blend Mode Text Effect | Mix-blend-mode | CSS

Creative CSS Mix Blend Mode text effect | mix-blend-mode | CSS

Description:

Today I will teach you how to make creative CSS mix-blend-mode text effects in this video. If you have any questions about this video you can ask in the comment section below and if you want to learn how to make more such videos or front-end projects then visit my channel. Subscribe and Like and Share Videos.


Facebook: https://www.facebook.com/DesignTorch-100346018289702/
Twitter: https://twitter.com/DesignTorch2
Instagram: https://www.instagram.com/designtorch2020/
Tumblr: https://www.tumblr.com/blog/bat-designtorch
Mix: https://mix.com/designtorch
Pinterest: https://pin.it/5dJHtSn


Code: https://codepen.io/designtorch2020

Subscribe to our channel to see our new videos every day.
Subscribe: https://www.youtube.com/channel/UCjGW4IqtUQevNp56J9F35Pw


All Video Url :

  1. Animated Hamburger Menu Tutorial | jQuery Animations | CSS | 2021
    Watch This: https://youtu.be/QrdEgXfodx0​

  2. CSS Responsive Card Hover Effects | Gradient Cards Hover Effect | Html & CSS | 2021
    Watch This: https://youtu.be/MsJtarngKuA​

  3. How to make toggle switch using CSS | jQuery toggle button | 2021
    Watch This: https://youtu.be/S-agrQiE6gE​

  4. Responsive Image Gallery using Html CSS | Instagram Grid layout | 2021
    Watch This: https://youtu.be/tSyYU0I9gYU​

  5. How To Make Custom Radio Buttons With Cool Effect | Pure CSS | DesignTorch
    Watch This: https://youtu.be/GZh52Fh8o1o


Project Link: https://codepen.io/designtorch2020/pen/JjbaVoV
Google Fonts Link: https://fonts.google.com/specimen/Poppins?preview.text_type=custom


Music Source:

Eternal Hope by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 licence. https://creativecommons.org/licenses/by/4.0/

Source: http://incompetech.com/music/royalty-free/index.html?isrc=USUAN1100238

Artist: http://incompetech.com/

#css #jquery

Creative Text Styling with the CSS mix-blend-mode Property

Create enticing graphics with the CSS mix-blend-mode property which erases the need for tools like Photoshop.

mix-blend-mode is a CSS property that defines how the content of an element should blend with the content of the element’s parent and its background. With this, you can create nice blends and colors for parts of an element’s content depending on its direct background.

mix-blend-mode gives CSS developers greater flexibility to create native designs using real text on images, thereby removing the need to use often bloated images edited with tools like Photoshop.

One big advantage that gives us is better performance, as fewer images would be needed and file sizes would be significantly smaller. On top of that, using photoshopped images doesn’t provide the same SEO benefits that real text provides you.

Yet another important benefit of using mix-blend-mode as opposed to edited image alternatives is that you can use CSS animations, affording you the chance to add more life to your website and elements. Other practical use cases for mix-blend-mode include removing white background from logos and making dynamic text contrast whatever background it is on.

How mix-blend-mode works in a nutshell

mix-blend-mode creates what is known as stacking context. Stacking context is an imaginary z-axis relative to the user facing the viewport where the HTML elements reside. They occupy this space based on elements’ priorities. This is the same idea that the position CSS property uses, too.

mix-blend-mode applies to all elements, including SVGs, though this is not yet available on all browsers at the time of writing.

#css #web-development #programming

Billy Chandler

Billy Chandler

1654848329

CSS mix-blend-mode Property | Creative Text Styling/ Enticing Graphics

Creative CSS Mix Blend Mode text effect | mix-blend-mode | CSS

Today I will teach you how to make creative CSS mix-blend-mode text effects in this video. If you have any questions about this video you can ask in the comment section below and if you want to learn how to make more such videos or front-end projects then visit my channel. Subscribe and Like and Share Videos.

Code: https://codepen.io/designtorch2020 


Creative text styling with the CSS mix-blend-mode property

Create enticing graphics with the CSS mix-blend-mode property which erases the need for tools like Photoshop.

mix-blend-mode is a CSS property that defines how the content of an element should blend with the content of the element’s parent and its background. With this, you can create nice blends and colors for parts of an element’s content depending on its direct background.

mix-blend-mode gives CSS developers greater flexibility to create native designs using real text on images, thereby removing the need to use often bloated images edited with tools like Photoshop.

One big advantage that gives us is better performance, as fewer images would be needed and file sizes would be significantly smaller. On top of that, using photoshopped images doesn’t provide the same SEO benefits that real text provides you.

Yet another important benefit of using mix-blend-mode as opposed to edited image alternatives is that you can use CSS animations, affording you the chance to add more life to your website and elements. Other practical use cases for mix-blend-mode include removing white background from logos and making dynamic text contrast whatever background it is on.

How mix-blend-mode works in a nutshell

mix-blend-mode creates what is known as stacking context. Stacking context is an imaginary z-axis relative to the user facing the viewport where the HTML elements reside. They occupy this space based on elements’ priorities. This is the same idea that the position CSS property uses, too.

mix-blend-mode applies to all elements, including SVGs, though this is not yet available on all browsers at the time of writing.

Syntax and values

The syntax for mix-blend-mode is:

mix-blend-mode: <blend-mode>

Where <blend-mode> can be any of the following values:

normal

mix-blend-mode:normal

This is the default value on the property and does not add any blend mode.

multiply

mix-blend-mode:multiply

This multiplies the element’s color with that of the background. This resulting color is mostly darker, depending on the background.

screen

mix-blend-mode:screen

screen makes the content much brighter than its background. It multiplies the content color with its background and complements the result.

overlay

mix-blend-mode:overlay

What overlay does is multiply if the background is darker than the content and screen if the background is lighter than the element’s content. This is similar to hard-light with the background and content color conditions inverted.

darken

mix-blend-mode:darken

This darkens the area of the background that is dark and leaves other parts unchanged.

lighten

mix-blend-mode:lighten

The content gets lighter around the parts of the background that have a light color. It’s opposed to darken.

color-dodge

mix-blend-mode:color-dodge

This brightens the background color to reflect the color of the element’s content. The result is derived from dividing the background color by the inverse of the content’s color. You would notice the resulting color of the content is usually very “loud.”

color-burn

mix-blend-mode:color-burn

This is the opposite of color-dodge. This value darkens the color of the background to reflect the element’s content color. The result is gotten from inverting the background-color, dividing it by the content’s color, and inverting that result. If the content’s color is the inverse of the background color, then the result is black.

hard-light

mix-blend-mode:hard-light

hard-light will multiply if the content color is darker than the background, and screen if the content color is lighter. This is similar to overlay, but the background and foreground are swapped.

soft-light

mix-blend-mode:soft-light

Almost the opposite of hard-light. This will apply lighten or darken depending on the color of the content. It gives a softer look than what hard-light results in.

difference

mix-blend-mode:difference

difference picks the darker of the colors between the content and background and subtracts it from the other (lighter) color. If either of the colors between both content and background is white, then the result is an inverse of the other color.

exclusion

mix-blend-mode:exclusion

This is similar to difference, but with much lower contrast. As with difference, if either of the colors between both content and background is white, then the result is an inverse of the other color.

hue

mix-blend-mode:hue

Hue combines the hue of the content and the saturation and luminosity of the background to create a color for the content.

saturation

mix-blend-mode:saturation

saturation, on the other hand, combines the saturation of the content and the hue and luminosity of the background to create a color for the content.

color

mix-blend-mode:color

color creates a color for the content by combining the hue and saturation of the content with the luminosity of the background.

luminosity

mix-blend-mode:hue

luminosity inverts the color attribute. It combines the luminosity of the content with the hue and saturation of the background to create a color for the content.

Demo

Some other use cases for mix-blend-mode

Cut-out effect

In this example, we’re able to create a cut-out effect for the text by giving the text a white background and using the screen blend mode.

Spotlight effect

This next example portrays a spotlight effect. The text is hidden until the light reflects on it. This is achieved by using the darken blend mode on the text, so it shows only when the div with the yellow color is on it

Using mix-blend-mode with filter

Combining mix-blend-mode with the filter property helps you achieve really engaging and enthralling designs with CSS. You can use filter on both the content and background to get whatever effect you want.

In the example below, we are able to achieve a bleached-looking design by applying an invert filter to the background and content, then using difference for the mix-blend-mode.

Demo

Here’s another similar one I use on my website

Removing white background from a logo

Let’s say you have a logo image that has a white background, and the background over which you place that image isn’t white. Of course, simple solution is to use a tool like Photoshop (or even free tools like remove.bg) to clip out the white background, but this can also be achieved using mix-blend-mode. Demo

multiply multiplies the background color with the content color, so the white part of the logo changes to the color of the background. I used filter:contrast(1) to make the logo brighter since the multiply value make the logo a bit darker.

Although this may not be an optimal solution for this problem, it may still come in handy in some scenarios.

Conclusion

The possibilities with mix-blend-mode are, dare I say, endless. It opens up a whole new world of abilities to you as a frontend developer. You can keep experimenting and trying mix-blend-mode with different properties, including background-blend-mode.

I hope this article was able to give you an introduction to using mix-blend-mode and show you relevant examples you may want to use.

#css #programming #webdev 

Alayna  Rippin

Alayna Rippin

1603188000

Creating a CSS Visual Cheatsheet

The other day one of our students asked about possibility of having a CSS cheatsheet to help to decide on the best suited approach when doing this or that layout.

This evolved into the idea of making a visual CSS cheatsheet with all (most) of the common patterns we see everyday and one of the best possible conceptual implementation for them.

In the end any layout could and should be split into parts/blocks and we see every block separately.

Here is our first take on that and we would be happy to keep extending it to help us all.

Please, send you suggestions in the comments in community or via gitlab for the repeated CSS patterns with your favourite implementation for that so that we will all together make this as useful as it can be.

#css #css3 #cascading-style-sheets #web-development #html-css #css-grids #learning-css #html-css-basics