Can cards be designed with a color gradient background using a radial gradient?

I'm trying to create a card with a gradient background color.

Expected: I want the background color to be a gradient (like the green color behind the image) https://i.sstatic.net/ujiuz.png

Actual: Currently, the background color is not a gradient and only accepts one color (no gradient) https://i.sstatic.net/1UNJ5.png

The specific gradient I want is

linear-gradient(300deg, #6DBF67 1.06%, #A8DAA4 100%)
. Is it possible to achieve this gradient effect? Additionally, I also need radial-gradient and filter effects on the sides of the card to make it look like ticket card.

Here is the code snippet I am using:

.App {
  font-family: sans-serif;
  text-align: center;
}
// Rest of the CSS...
}
<div className="container">
  <div className="flex">
    <div className="section-left">
      <div className="wrapper-img">
        <img src="https://d3hi9gzi0oybee.cloudfront.net/assets/e-commerce/icons/ic-otten-point.svg" width="21px" height="21px" />
      </div>
    </div>
    <div className="section-right">
      <div className="flex-sb">
        <h4 className="title">Title</h4>
      </div>
    </div>
  </div>
</div>

You can view and experiment with my code in this sandbox: card-ticket. Thank you!

Answer №1

To create a circular cut and easily apply your gradient, use a mask:

.circle {
  --radius: 20px; /* radius of circular cut */

  height: 100px;
  margin: 10px;
  border-radius: 10px;
  -webkit-mask: radial-gradient(var(--radius) at var(--radius), #0000 97%, #000) calc(-1 * var(--radius));
  
  background: linear-gradient(red, purple);
}
<div class="circle"></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

Learn how to send dynamic data to another HTML element using Ajax's success function

I received a successful ajax response from one HTML file, but I'm struggling to dynamically set the data from this response to another HTML file. Can anyone help me with this issue? Here is the code snippet from my ajax report: success: function( ...

Display the cost based on the selection made

I am currently working on a restaurant website and have designed a form with select options. My goal is to have a price appear for the selected option. While I know that JavaScript is the solution for this, I must admit that I am not very proficient in Jav ...

Innovative approach to managing extensive geospatial datasets

I developed a unique application that incorporates points onto a map within specific polygons. This app is built using Windows Forms with a straightforward user interface. The points are pre-filtered and the program utilizes Python, geopandas, and folium l ...

Dynamic content loading using AJAX to selectively update a designated section

I am having trouble displaying the error message in my form. Currently, it is causing my form page to load four times. Can someone help me identify what I did wrong? I only want to display that span: controllers: <?php /* * File Name: user.php */ ...

My component reference seems to have gone missing in angular2

Trying to load my Angular 2 app, I encountered this error: https://i.stack.imgur.com/FmgZE.png Despite having all the necessary files in place. https://i.stack.imgur.com/kj9cP.png Any suggestions on how to resolve this issue? Here is a snippet from ap ...

Using Javascript to attach <head> elements can be accomplished with the .innerHTML property, however, it does not work with XML child nodes

Exploring new ways to achieve my goal here! I want to include one JS and one jQuery attachment for each head section on every page of my static website. My files are: home.html <head> <script src="https://ajax.googleapis.com/ajax/libs/jquer ...

Angular 2 Form Error: Control Not Found

I'm facing an issue with Angular 2 Forms where adding more than one control seems to be getting ignored. Despite following numerous guides on how to properly implement this, none of the suggested methods seem to work in my case. In my template, I hav ...

Tips for positioning tables on a page

I have 4 tables and a submit button. How can I make them more compact? Maybe like this: </img> This is my HTML code: <body> <form action="/cgi-bin/form.py" id="myform"> <table class="table-fill"> ... ...

What is the trick to shortening paragraphs with dots...?

There is a p tag, <p> most iconic character in cinema</p> I need to truncate the text after 8 characters, and display dots afterwards. For example: most ic... Is there a way to achieve this using CSS? Any help with AngularJS would also be ...

Is there a way to automatically calculate the sum of two boxes and display the result in a separate

I am working with two boxes: one is called AuthorizedAmount and the other is called LessLaborToDate: <div class="col-md-6"> <div class="form-group"> <label>Authorized Amount</label> <div class="input-group"> & ...

How to keep the Bootstrap column in place while making it fixed

I'm struggling to make the second column (yellow part) stay fixed in position. I've tried using CSS position:fixed, but the column keeps shifting to the left. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/cs ...

The use of event.returnValue is outdated and no longer supported. It is recommended to use the standard event.preventDefault() method instead. You may encounter

Hey there :) Currently, I am utilizing JQuery 1.9.1.js to search records using JSON. I am able to retrieve the search list locally, but when attempting to publish it on Windows Server 2008 and IIS 7, I face issues as it throws an error stating "event.ret ...

Display multiple videos next to and below one another in a responsive layout

I am attempting to display multiple Vimeo videos responsively alongside and below each other. I have noticed that when using the embed-responsive feature, the videos may not align perfectly if different videos are used. However, they align perfectly when t ...

Footer not positioned at the bottom of the page

I have been experimenting with different ways to keep my footer at the bottom of the page. Initially, I tried using position: static, but the footer ended up above the bottom of the page and the background was visible (similar to the image below). Then, I ...

Tips for choosing the default tab on Bootstrap

I have a question about an issue I am facing with my Angular Bootstrap UI implementation. Here is the code snippet: <div class="container" ng-controller='sCtrl'> <tabset id='tabs'> <tab heading="Title1"> ...

Unable to conceal HTML5 video in mobile devices through media query

I've been struggling to find a solution for hiding a video on mobile devices. Despite going through numerous posts and attempting different methods, I haven't been successful in using @media queries to hide the video and show an image instead. He ...

"Enscroll – revolutionizing the way we scroll in

I recently incorporated the "enscroll" javascript scroll bar into my webpage. You can find more information about it at <div id="enscroll_name"> <ul> <li id="p1">product1</li> <li id="p2">product2</li> ...

What is the method for incorporating text below font icons?

Having a bit of trouble here with my code snippet featuring 'font awesome' icons in circles. I'm looking to add text beneath each icon, but the alignment within the circle is proving to be a challenge. Check out the code in this link to see ...

A guide on transforming JSON data into HTML using Rails

I'm struggling with parsing JSON on a webpage. My webpage is designed with circles, where clicking on a circle triggers a call to the controller to retrieve specific information from a database and display it as graphs and text. The issue I'm fa ...

Rails does not appear to have Bootstrap installed

Having trouble with Bootstrap integration, encountering the error message: Sprockets::FileNotFound in Home#index Showing /Users/user/Ruby/app/views/layouts/application.html.erb where line #5 raised: couldn't find file 'twitter/bootstrap/responsi ...