Guide to removing text color from a background with css or javascript

Is there a way to achieve the effect shown in this image on my HTML page: http://prntscr.com/b912c0? I've attempted using mix-blending modes, but haven't been successful in recreating the desired result.

Any tips or tricks for accomplishing this?

Answer №1

It appears that I have found the solution you were searching for. The final outcome is operational in web browsers supporting webkit, with a fallback option for those that do not. Testing on FF Developer Edition and Google Chrome indicates successful functionality, while the fallback is visible on IE and the standard version of FF.

You can view the implementation here: http://codepen.io/fishgraphics/pen/b7eade9e3c83e8c8c173fe448f175d92

The main content lies within the CSS styling:

html {
   background: #ceb691 url('http://img0.mxstatic.com/wallpapers/0f458fce470938f1695a8f9865485f17_large.jpeg') center no-repeat fixed;
}

header {
   background: rgba(0, 0, 0, 0.8);
}

.backgroundclip h1 {
   background: url('http://img0.mxdynamic.com/wallpapers/0f458fce470938f1695a8f9865485f17_large.jpeg') center no-repeat fixed;
   -webkit-background-clip: text;
   -webkit-text-fill-color: transparent;
}

h1 {
   width: calc(100% - 60px);
   margin-top: 200px;
   font-size: 5em;
   padding: 60px 30px;
   text-align: center;
   color: orangered;
}

Incorporating Modernizr slightly:

Modernizr.addTest('backgroundclip', function() {

   var div = document.createElement('div');

   if ('backgroundClip' in div.style)
      return true;

   'Webkit Moz O ms Khtml'.replace(/([A-Za-z]*)/g, function(val) {
      if (val + 'BackgroundClip' in div.style) return true;
   });

});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using Jquery, insert a line break when a specific character is entered in a text area by pressing the Enter button

$('.text-description').keyup(function () { var count = $(this).val().length; if(count == 63){ //insert line break here } }); When the character count reaches 63, including spaces, I want the cursor to move to the next line (sim ...

Angular Material Sidenav fails to cover the entire screen while scrolling

https://i.stack.imgur.com/32kfE.png When scrolling, the Sidenav is not expanding to take up 100% of the screen and it continues to scroll along with the page content. <div layout="column"> <section layout="row" flex> <!-- siden ...

Retrieving precise content from a span tag using Python (BeautifulSoup)

Currently in the process of web scraping MyAnimeList with BeautifulSoup on Python3 to extract data about the 'Status' of a particular show, but encountering issues with accessing the desired information. Below is the snippet of HTML: <h2>I ...

Choose-option "No entries found for that specific query"

Looking for help with setting up a voting function. The vote.js script seems to be working fine, but I'm unable to get the object. Any suggestions? It appears that the POST request is not being sent. Thank you. Encountering this error: Page not foun ...

The @Html.Label feature fails to appear when the content includes a period (.) - Utilizing Bootstrap with MVC Razor

I am dynamically populating label text from a database source <div class="col-11 col-sm-11 col-md-11 col-lg-11 col-xl-11"> @Html.Label(@Model.Questions[i].DataText + ": ", new { @for = "dd" + @Model.Questions[i].Data ...

The clash between CSS's 'snap-scroll' and jQuery's '.animate scrollLeft' functionality

My HTML and CSS slider utilizes the scroll-snap feature for manual scrolling along with jQuery buttons for automated scrolling. However, I have encountered an issue where using scroll-snap-type: x mandatory; causes severe lag in the jQuery scrollLeft anima ...

Positioning Multi-level Drop Down Div in Javascript - How to do it efficiently?

I'm currently working on a horizontal menu using CSS and JavaScript with multiple levels. I've implemented a toggle function to show the submenu container, but it's causing the links below it to be pushed down. Is there a way to make the dis ...

Is it possible to activate the :active pseudoclass by pressing the 'enter' key on the keyboard using solely CSS?

The CSS: a:focus { opacity: .75 } a:active { transform: translateY(4px) } The purpose: When keyboard users tab to the link, the :focus style serves as a visual indicator Upon pressing the enter key to activate the link, the :active style provides ...

Error: Access Denied (CSRF token not found or invalid) - despite being present

Despite including a csrf_token, I keep experiencing the error mentioned above. I have successfully used the same csrfmiddlewaretoken for my other ajax calls without any issues, but for some reason, I'm encountering a forbidden error in this case. Any ...

Minimizing the use of line breaks in HTML to enhance visual design characteristics

While working with Bootstrap and HTML to construct a website, I have frequently resorted to using line breaks in the code for design purposes. However, I believe there must be a more professional approach to achieve the desired layout. For instance, on ...

What Methods Can I Use to Acquire the Device ID?

Is there a way to retrieve the device ID using Jquery or pure JavaScript, without relying on Cordova for my project? I have come across solutions that involve Cordova, but I prefer not to use it. Are there any alternatives available? Edit: By unique ID, ...

Enhancing Select Options with jQuery to Include Default Properties

In this scenario, imagine having a select menu with options in Angular. If I want to attach an array to each option so that when someone selects "Man Haircut," the client-side automatically knows that the price is $10, duration is 30 minutes, and there&apo ...

Adding Hebrew characters from the URL query string to a field's content

I have encountered an issue while trying to extract a query string parameter value and inserting it into a field. The parsed output is not as expected. Here is the URL with the query string: activities.html?t=שלום Instead of displaying the value "ש ...

What is causing my text to not appear in a single line?

Can someone help me figure out why my register and login options are overlapping? I'm pretty new to this so it might be a simple fix. Also, I'm trying to get the dropdown menu to appear right below the login text, but I'm facing some issues ...

Guide on creating a div container that spans the full width of the HTML page with a horizontal scrollbar

I'm facing an issue where the div container is not extending over the entire HTML page with a horizontal scroll bar. Here's a visual representation of my problem: Image Despite using MathJax to display math formulas, the div container does not ...

Using an onClick event along with jQuery to change the CSS class style of another div

After searching extensively without success, I decided to register and ask my first question here. Hopefully, someone can provide a solution: My goal is to create a set of five buttons (divs) with onClick events that will show five different divs. I' ...

Place the cursor at the conclusion of the text box

I am working on creating a user input form for chat messaging and I need some help. Here is the HTML-code snippet that I am currently using: HTML-code Currently, when the user presses ENTER, I retrieve the text from the textbox and save it. If the user ...

Decoding a JSON object in node.js

{"__v":0,"_id":{"$oid":"55f13d34258687e0bb9e4385"},"admin":true,"email":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b3d6ded2c3dfd682f3d4ded2dadf9dd0dcde">[email protected]</a>","last_login":"11:25:24 AM","name ...

Interactive Sidebar Navigation Content

On my website, I have a navigation sidebar that contains links to all of the main site pages. Each page has the same links, except the link to the current page is not included, making it easy to visually identify which page you are on. Currently, I manuall ...

Can we show the dropdown with the active button?

Can someone assist me in transforming my sidebar buttons into dropdowns when viewed on a responsive layout? I'm looking for something similar to the sidebar (on the left) featured on this website: If possible, I would like the dropdown to only displa ...