How can I style my text using CSS with a linear gradient, shadow, and outline effect

Can text be styled with a linear gradient, shadow, and outline all at once?

I'm running into an issue where setting "-webkit-text-fill-color: transparent" for the gradient causes the shadow to appear on top of the text.

Is there a way to have the text appear on top of the shadow instead?

Below is the code snippet I'm currently using:

p {
  font-size: 100px;
  background: linear-gradient(to bottom, red, blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 2px black;
  text-shadow: 15px 15px black; 
    }
<p>Some Text</p>

Answer №1

Check out this solution:

p {
  font-size: 100px;
  background: linear-gradient(to bottom, red, blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 2px black;
  filter: drop-shadow(15px 15px black);
}
<p>Some Text</p>

Replace text-shadow with this code

View the result in the screenshot

Answer №2

Here is an example of how you can implement the code:

p {
color: black;
background: -webkit-linear-gradient(#1de268, #4662FF);
-webkit-text-stroke-width: 1px;
-webkit-text-stroke-color:#FF8802;
-webkit-text-fill-color:transparent;
-webkit-background-clip: text;
text-shadow: 0px -8px 2px rgba(0,0,0,0.25);
}

Answer №3

Absolutely! It is indeed possible to assign a negative value to your shadow. To achieve this, you can use the following code: text-shadow: -3px -5px black;

Answer №4

Adjust the shadow attribute. Swap out text-shadow for:

filter: drop-shadow(10px 10px gray);

Answer №5

Hey there! Have a look at this code snippet, it might be useful for you.

p {
  color: blue;
  font-size: 100px;
  background: linear-gradient(to bottom, red, blue);
  -webkit-background-clip: text;
  -webkit-text-fill-color: rgba(255,255,255,0.3);
  -webkit-text-stroke: 2px black;
   text-shadow: 15px 15px 2px rgba(0,0,0,0.9); 
}
    
<p>Some Text</p>

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

jQuery loops through form fields and sets them as disabled

Trying to solve a question... In a form with multiple inputs, I only need to loop through the ones inside the div tagged player. <div class="player"> <input type="text" value="0" class="unit" /> <input type="text" value="0" class="unit" ...

Using the power of jQuery to load Ajax content, unfortunately, the content remains

Hey there, I'm currently working with an HTML file that utilizes AJAX to load content from other HTML files on the same server. However, for some reason, it's not functioning properly. I'm new to AJAX and I'm not sure what could be caus ...

Set the color of the text in the Material UI pagination component to a subtle shade

I would like to customize the color of the text in Material UI's pagination component. Specifically, I want the action button to be white and the text portion to be grey, similar to the left action arrow in the image below. Is there a way for me to ac ...

Is it possible to use a TypeScript Angular (click) event with an object property as the value?

Seeking assistance in creating a dynamic error card featuring various error messages along with a retry button. Below is a snippet from my TypeScript object: errorCard: any = []; if(error) { this.errorCard.errorMessage = "Oops, please try again"; ...

Angular - Uploading Files

Within my $scope.accept function, I am attempting to upload some files to my server. The process works fine when using the tag in my HTML. However, I wish to prevent the page from redirecting and instead handle this with AJAX in my controller. When tryin ...

How can I successfully transfer all user information when the edit button is clicked?

A new display page has been developed using php to show all user records in a table. The page includes delete and edit buttons for managing users. While the delete option is working fine, there is an issue with getting the edit button to function correctly ...

In react-native, when the string includes spaces, it will result in a line change

I am currently utilizing react-native in combination with styled-components. Whenever a string is typed into the text and followed by pressing the spacebar, it either results in too many line breaks or creates excessive empty spaces. An example of this i ...

Struggle with incorporating a file

As part of the login process, I have two options available: easy login and standard login. The easy login requires an employee ID, birthdate, and captcha answer, while the standard login asks for first name, last name, birthdate, and captcha. To facilitate ...

Creating a new form upon clicking

By clicking the "Add New Job" link, a new form with three fields will appear. This is the primary form: <h2>JOB EXPERIENCE 1</h2> <div class="job-content"> <input type="text" value="Company" name="company" /> <input type="te ...

When utilizing state in ReactJS to modify the color of my button, the change does not take effect on the first click. How can I troub

Whenever I click the button that routes to different locations via an API, the route works fine but the button color doesn't change on the first click. To address this issue, I implemented the useState hook and CSS to dynamically change the button co ...

Ways to enhance multiple ng-repeats efficiently with css grid

Looking to create a CSS grid table with 5 columns and an undetermined number of rows. The goal is to display a pop-up element when an element in the first column is clicked, covering columns 2 through 5. This ensures that only the first column remains visi ...

What is the best way to retrieve all of a user's records based on a specified selection

My HTML text input field looks like this: <input id="CustID" name="CustID" dir="rtl" value="<?php echo $CustID;?>" size="35" required="true" maxlength="9" > Whenever a user enters their number, I want a select box to display all tickets assoc ...

Using SCSS to target a sibling class when hovering over an element with CSS

Is there a way to alter styles of a sibling element on hover using only CSS? I attempted something similar but was unsuccessful. HTML: <ul> <li class="item active">name1</li> <li class="item">name2</li> <li clas ...

The image fails to display when using THREE.js and Panolens.js

Trying to create a 360-degree environment with informational buttons using THREE.js and Panolens.JS However, I'm unable to resolve why the image is not appearing. Continuously encountering the error: Uncaught ReferenceError: process is not defined. ...

Angular is unable to eliminate the focus outline from a custom checkbox created with Boostrap

Have you noticed that Angular doesn't blur out the clicked element for some strange reason? Well, I came up with a little 'fix' for it: *:focus { outline: none !important; } It's not a perfect solution because ideally every element sh ...

Having trouble with element.scrollTo not functioning properly on mobile devices?

I have been working on creating a vertical scrolling carousel, and so far everything seems to be functioning well. I can scroll horizontally using buttons and swipe gestures successfully on the simulator. However, when I view the website on a real mobile d ...

What is the best way to ensure both landscape and portrait images are completely responsive and equal in height within a carousel?

I am currently working with a bootstrap carousel that contains both portrait and landscape images. On wide screens, the carousel height is automatically set to match the tallest image's height. However, this behavior results in white spaces on the top ...

Is there a way to align this button perfectly with the textboxes?

https://i.sstatic.net/ODkgE.png Is there a way to align the left side of the button with the textboxes in my form? I'm using bootstrap 3 for this. Here is the HTML code for my form. I can provide the CSS if needed. Thanks. h1 { font-size:83px; ...

The size attributes on <img> tags do not function as expected

I'm facing an issue with the following code: $("#myId").html( "<img src='" + $(xml).find("picture").text() + "' height="42" width="42"></img>" ); Everything works perfectly until I include the 'height="42" wid ...

Arrange the HTML DOM elements in the order of their appearance in a list

Is it possible to rearrange the order of <div> and its elements based on database information? For example, consider the following HTML structure: <div id="container"> <div id="A"> Form elements for A</div> <div id="B"& ...