CSS/ Javascript - emulate the appearance of the image using CSS3 or Javascript (sticker-like design)

Hi, I need help figuring out how to recreate this image using only CSS for the font and style.

I attempted it with this code on JSFIDDLE: JSFIDDLE CSS

 *{
        font-family: 'Asap', sans-serif;
        font-size:130px;
        color:#444;
        font-weight:bold;
        letter-spacing:-3px;
    }
    body{
        background:url('http://img.ly/system/uploads/007/221/887/large_antani.png') no-repeat left 190px ;
    }
    img{
        width:auto;
        height:auto;
    }
    a{

        text-shadow:
           3px 3px 0 #fff,
         -1px -1px 0 #fff,  
          1px -1px 0 #fff,
          -1px 1px 0 #fff,
           1px 1px 0 #fff,
            0px 2px 2px #ccc, 0px 4px 4px #ccc,0px 6px 6px #ccc;
    }

HTML

<a>asd</a>

Any suggestions are greatly appreciated.

If you believe replicating this image using pure CSS is not possible, please let me know so I can make other arrangements. I am aware that CSS cannot create text gradient colors, so I am considering using a library like this: https://github.com/mrnix/pxgradient

The biggest challenge for me is getting the text shadow to look like in the image. Thank you!

Answer №1

I have updated the text-shadow styling to achieve a similar effect:

text-shadow: 0 0 0 20px white, 4px 4px 4px 20px #ccc;

This particular style will only be visible on browsers that support text-shadow spread (such as IE10). While it may not replicate the exact gradient effect in the image, it is a closer match.

Unfortunately, creating a gradient from light-blue to slightly-darker-blue within the text color itself is not feasible at this time. You will need to choose a solid color that complements your design instead.

If you require a solution that works across all browsers, utilizing images for this effect would be the most reliable option.

Answer №2

In my opinion, choosing an image for this purpose would be the best decision. For a simple png like this, the effort required to code it is not justified, and using an image will provide optimal cross-browser support. Logos are a crucial aspect of branding, and ensuring full cross-browser compatibility is essential for maintaining brand recognition.

If you still want to code your logo, I recommend using an svg file for the closest match possible. You can replicate the logo in Illustrator (if you have it) and save it as an svg for easy integration into a webpage.

Answer №3

Check out this similar design based on the image.

Using a duplicate anchor is necessary because of the

-webkit-background-clip: transparent;
property, which clips out the shadow while creating a gradient effect on text. Note that this approach may not be compatible across all web browsers.

Here's an example of the code:

<div class="replica">
    <a class="link">asd</a>
    <a class="shadow">asd</a>
</div>

And here's the corresponding CSS:

.replica {
    position: relative;
}
a {
    font-style:italic;
    background: -webkit-gradient(linear, left top, left bottom, from(#99FFFF), to(#0DC4F3));
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
}
a.link {
    position: absolute;
    left:0;
    top:-2px;
    background: -webkit-gradient(linear, left top, left bottom, from(#99FFFF), to(#0DC4F3));
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
}
a.shadow {
    text-shadow: 3px 3px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0px 2px 2px #ccc, 0px 4px 4px #ccc, 0px 6px 6px #ccc;
}

Answer №4

If you're feeling adventurous and don't mind sacrificing some speed, consider using jquery to create a text shadow from every possible angle.

Check out this example on how to implement it.

I experimented with jquery to generate shadows for each specific angle... It does slow things down quite a bit, especially with multiple elements... but it's an interesting effect nevertheless.

function createShadow(element) {
    var spread = 10; // distance of the shadow
    var shadows = []; // array to store all text shadows
    
    for(var i = 0; i <= 361; i++) { // iterate through every angle
        var angle = i;
        var pointX = spread * (Math.sin(angle)); // calculate direction 
        var pointY = spread * (Math.cos(angle)); // of the text shadow
        
        if(i == 361) { // add one final black shadow at the end
            var shadow = '20px 20px 20px black'; 
        } else {
            var shadow = pointX + 'px ' + pointY + 'px 0 white';
        }
        
        shadows.push(shadow); // add shadow to the array
    }

    element.css({
        textShadow: shadows // apply all shadows (note: can be slow)
    });
}

$('a').each(function() { // apply above function to each link
    var element = $(this);
    createShadow(element);  
});

To create gradient text, refer to this tutorial: http://css-tricks.com/snippets/css/gradient-text/ (CSS3 and Webkit only).

Alternatively, try something like this:

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

Tips for keeping the footer consistently at the bottom of the page without using a fixed position (to avoid overlapping with the main content)

I've been struggling to keep the footer at the bottom of my webpage. I came across a solution online suggesting to use fixed CSS positioning. However, when I applied this fix, the footer ended up overlapping with the actual content on the page. Is the ...

Encountering a 404 error while loading CSS in a Django application

I'm currently in the process of developing a chatbot application. I'm encountering issues with loading the CSS for the frontend using django's static data load feature. Here are the file paths: CSS path: C:\Documents\Django_Works ...

What is the best way to automatically set today's date as the default in a datepicker using jQuery

Currently utilizing the jQuery datepicker from (http://keith-wood.name/datepick.html), I am seeking to customize the calendar to display a specific date that I select as today's date, rather than automatically defaulting to the system date. Is there a ...

The added class is not being successfully applied to the ClassList

I'm currently working on a page where I want the colors of a button and the background to switch when the button is clicked. document.querySelector("body.light").classList.toggle("dark"); document.querySelector("button.dark").classList.toggle("light" ...

Is there a way to get an iframe to mimic the behavior of other media elements within a horizontal scrolling container?

Take a look at this code snippet: $(document).ready(function() { $('.scrollable-area').on('wheel', function(e) { var scrollLeft = $(this).scrollLeft(); var width = $(this).get(0).scrollWidth - $(this).width(); var delta ...

"Need to refresh localStorage in VueJS after navigating back with this.$router.go(-1)? Here's how

Below is my Login.vue code: mounted() { if (localStorage.login) this.$router.go(-1); }, methods: { axios.post(ApiUrl + "/login") { ... } then(response => { ... localStorage.login = true; this.$router.go(0); ...

Unable to perform real-time transpilation of ES module, a loader plugin must be set up through the SystemJS.config configuration

I encountered an issue while trying to develop a plugable application. Everything was functioning correctly until I introduced "ngx-bootstrap" and "FullCalendarModule"/primeng in the plugin app. Importing any of these modules resulted in the following erro ...

Error in Javascript, exception was not handled

I have encountered an issue while using a javascript file named pull.js. This file is meant for implementing pulldown refresh functionality on iPad. However, when I use this file, it seems to interfere with other jQuery and javascript functionalities, caus ...

Is it possible to create a pitch shifter with the web-audio-api?

Creating a Pitch Shifter with Node.js Hello, I am new to web development! I am currently working on developing an online audio player that requires a pitch shifter. I have been attempting to grasp the concept of the web audio API, but find it challengin ...

Creating a web form with HTML and integrating it with jQuery AJAX

Looking to fetch data from the server through jQuery AJAX on an HTML form and store the response in a PHP string variable. Here is my current code snippet: <form method="post" name="myform" id="myform" action="https://domain.com/cgi-bin/cgi.exe"> &l ...

The first Ajax call was successful, but the second Ajax call was unexpectedly sent twice

After making an AJAX call to post the value of a textarea to the database, I have noticed a strange issue. The first post always goes through correctly. However, when attempting to post another entry, the AJAX call seems to be executed twice. Subsequently, ...

Use JavaScript to access the dynamic checkboxes in an ASP table by utilizing the functions checkall, uncheck, and middlestate

Currently, I am working on creating a privilege group checkbox similar to the one shown in this link. On my page, I have created an empty control that looks like this: <fieldset> <legend><asp:CheckBox ID="GroupName" runat="server" TextAl ...

Z-Index Problem with PureCSS Horizontal Scrollable Menu

I've been working on this issue but can't seem to get it right. I have a purecss menu with a horizontal scrollable feature, but the submenus at depth 1 and 2 don't appear on hover in Firefox and Safari - they are being hidden underneath. I ...

Preventing the page from scrolling to the top while utilizing an Angular-bootstrap modal and a window position:fixed workaround on an iPad

It's common knowledge that there is a bug in bootstrap modals on certain devices, causing the page behind the modal to scroll instead of the modal itself (http://getbootstrap.com/getting-started/#support-fixed-position-keyboards) An easy fix for this ...

When redirecting to a .scala.html file in Scala Play, only text is displayed, not the full

I recently set up the Google OAuth hybrid server-side flow, which involves making an AJAX call to retrieve an access token. Upon successfully storing the token, I want the server to display content using a file named home.scala.html. // This function is c ...

Tips for including a line within a circular canvas

My progress bar crafted with css, javascript and html looks great (left image). However, I'm facing a challenge in adding white color dividers to enhance the appearance of the progress bar as shown in the image on the right. Despite my various attemp ...

Expanding CSS transition for child elements as they increase in size

I am currently working with Vuetify and have encountered an issue with a v-list-item that contains a title and a subtitle. The problem is that the title is restricted to displaying only one line. If the title exceeds this limit, it gets cut off and shows " ...

Issue with JQuery loading causing disruption to HTML text formatting

I set up a heading on my website by using the following HTML code: <div id="question"> <h1>Question Goes Here</h1> </div> The font style is controlled by my CSS and it's set to size h1. The text displayed there is tempora ...

Leverage the power of HTML5 localstorage in order to maintain the toggle state of jQuery even

After discovering the HTML5 "localstorage" function, I decided to try implementing it in combination with jQuery toggle to keep a div in its most recent state even when the page is refreshed. It seems like a more modern alternative to using cookies. Howeve ...

Communicating data transfer between two Node.js servers through the use of the Node Serial Port technology

How can I send the message "Hello world" from one nodejs server to another using node-serialport? I have confirmed that the radios connecting the two servers are properly connected as they are displaying buffer information after running my current code. ...