Create a border around the text using a strokeoutline

I'm attempting to apply an outline to text using CSS.

The issue I'm facing is that the shadow doesn't work well for perfectly stroked text.

Is there a way to achieve this with just CSS?

Below is the code snippet I am currently using:

.text-stroke {
  font-size: 200px;
  color: #fff;
  text-shadow: -1px -1px #2d4c79, 
                1px 1px #2d4c79, 
               -2px 2px #2d4c79, 
                2px -1px #2d4c79;
}
<div class="text-stroke">Text</div>

Answer №1

Try utilizing the CSS property webkit-text-stroke

.text-stroke {
  font-size: 150px;
  -webkit-text-stroke: 2px black;
  -webkit-text-fill-color: red;
}
<div class="text-stroke">Sample Text</div>

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

Include a name in the set_values function using Rvest

I'm currently working on scraping data from this website. I have a code written in rvest for login, but each time the page refreshes, the form name changes. library(rvest) loginpage <- "https://demo.glpi-project.org/" pagesession <- html_sess ...

What is the best way to display a div in Chrome without allowing any user interactions?

I currently have a <div> placed on top of my webpage that follows the mouse cursor. Occasionally, users are able to move the mouse quickly enough to enter the tracking <div>. Additionally, this <div> sometimes prevents users from clicking ...

The alignment of inline contenteditable tags is not working properly in Internet Explorer

I am facing an issue where inline contenteditable span tags are working fine in all browsers except for IE. In Internet Explorer, the tags are not acting as inline and instead aligning themselves as block elements. This behavior seems to be caused by IE wh ...

Crafted using rope-inspired animation, completely CSS-based

My current project involves creating an animation that mimics the action of a rope being cut. Imagine an object suspended by two ropes, with one being cut followed by the other. Although I have made progress in achieving the desired effect, my animation la ...

Ways to streamline a form containing several duplicate rows and make it more user-friendly

Looking for some advice on implementing a "working hours" module. Just need something simple like: Monday: 10:00 - 18:00 ... Saturday: 11:00-16:00 with some additional info. I'm currently attempting to... <form id="working_hours"> <s ...

Unable to navigate to input field in Ionic app while focusing on input field on mobile device

Default phone feature: When an input is focused on a mobile device, it automatically scrolls to that input. Issue: This functionality is not working in my ionic app due to horizontal scrolling. Consequently, when I tap on an input, it does not scroll to i ...

Issue with Bootstrap columns being misaligned on mobile devices

On my website, I've implemented a Bootstrap Grid design with three columns under the container-fluid BS attribute, along with .row .no-gutters. While the boxes are perfectly aligned in the desktop view, they stack vertically on mobile and tablet devi ...

What could be the reason for the onClick event functioning only once in HTML?

Below is the code snippet containing both HTML and JavaScript. However, the issue I am facing is that the onclick event only seems to work for the first <li>. <!DOCTYPE html> <html> <body> <ul class="list"> <li ...

Creating animations with an svg mask can be effective, however, it seems to only work properly

I have been experimenting with creating a transition effect using SVG masks and CSS. Initially, everything was working as intended, but after a few repetitions (usually 1 or 2, unpredictably), the transition effect would suddenly stop and become instantane ...

Is there a way to make FullPage and Lightbox compatible with each other?

Currently utilizing Fullpage.js for my website, I am looking to incorporate a lightbox in one of the sections. However, upon attempting to load the script and CSS, my fullpage layout breaks and the sections collapse. I have experimented with placing the ...

Ways to disable the ability to close a bootstrap modal by pressing the backspace key

How can I enable the backspace button in a Bootstrap Modal form for textboxes and textareas? $('body').keydown(function (e) { if ($('#myModal').is(':visible')) { if (e.keyCode == 8) { retu ...

struggling to update an array with user inputs on my to-do list app

I'm currently in the process of creating a small to-do list with some specific functionality. I want each text input (or a copy of it) to be added to an empty string, ensuring that the original input remains unchanged. The goal is to have a function t ...

"Stay entertained with a captivating animated gif that appears when you refresh the

I just implemented this code snippet to enable animated gifs to work after refreshing a webpage. It's functioning properly in Chrome, Safari, and Internet Explorer except for Firefox. Can someone please offer assistance? jQuery: $(img).css("backgrou ...

What is the best way to style the header of a table when scrolling in CSS?

Currently, I am facing an issue with applying the top CSS property to the thead element of a table while scrolling. I have attempted various methods but have been unsuccessful in achieving the desired outcome. Initially, I used the scroll event, however, ...

Assign and retrieve unique identifiers for checkboxes

One of the challenges I'm facing is working with an array of ID's from a database in combination with a table layout: The ID array includes specific record identifiers, for example: Array ( [0] => Array ( [id] => 1 [code] => GHY87 [de ...

Incorporating ContentPlaceHolder in ASP.NET MasterPage

For my In-Application CMS project, I am considering allowing users to upload an HTML and a CMS file as the Masterpage. One solution I have in mind is to have users include Pre-Defined Tags within their HTML files, which I can then replace with ContentPlac ...

Is there a way to disable certain CSS features in Chrome, like CSS grid, for testing purposes?

I'm exploring alternative layouts for my app in case CSS grid is not supported. Is there a way to disable features like CSS grid in Chrome or Canary? ...

Error message "Undefined is not a function" occurred while using jQuery's .replace and scrollTop functions

I'm having issues with the scroll function in my code. It doesn't seem to be able to locate the ids in my HTML, even though I can't figure out why. I had a previous version that worked perfectly fine (unfortunately, I didn't save it D:) ...

What could be preventing me from setting a boolean variable within an Observable?

After retrieving data from the Service, I am attempting to hide a specific div element. Below is the HTML code: <progressbar *ngIf="isLoadingBootStockData" [value]="100" type="default"> </progressba ...

PHP - Dynamically populating form questions based on user input

Currently, I am in the process of developing a fuel calculator form that utilizes PHP and HTML. The form is taking shape nicely, but there is one particular aspect that has me stuck. I want to incorporate a fuel perks feature that requires user input. Spe ...