What is the best way to apply fill to SVG using Tailwind CSS?

I tried using the code provided, but unfortunately, I was unable to Override the fill. The issue seems to have been resolved, but can someone help me achieve this using tailwind CSS?

<div className="">   
    <svg className="text-green-600 fill-current" width="52" height="52" viewBox="0 0 52 52"  xmlns="http://www.w3.org/2000/svg">
        <path d="M29.25 17.875C29.25 17.444 29.0788 17.0307 28.774 16.726C28.4693 16.4212 28.056 16.25 27.625 16.25C27.194 16.25 26.7807 16.4212 26.476 16.726C26.1712 17.0307 26 17.444 26 17.875V22.75H21.125C20.694 22.75 20.2807 22.9212 19.976 23.226C19.6712 23.5307 19.5 23.944 19.5 24.375C19.5 24.806 19.6712 25.2193 19.976 25.524C20.2807 25.8288 20.694 26 21.125 26H26V30.875C26 31.306 26.1712 31.7193 26.476 32.024C26.7807 32.3288 27.194 32.5 27.625 32.5C...
        </svg>

Answer №1

To enhance the design, it is recommended to eliminate the fill="#7400B8" attributes from every path element.

View the live demonstration by clicking on this link.

Answer №2

Although this tip is not directly related to Tailwind, it can still be valuable - you have the option to change the fill attribute to fill="currentColor", and simply apply the color class text-green-600 to a parent element (eliminating the need for fill-current).

<div className="">

    <svg className="text-green-600" width="52" height="52" viewBox="0 0 52 52"  xmlns="http://www.w3.org/2000/svg">

        <path d="M29.25 17.875C29.25 ..." fill="currentColor"/>
        <path d="M1.625 3.25C1.19402 ..." fill="currentColor"/>

        <defs>
        </defs>

    </svg>
</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

The content in the footer is not displaying correctly (Vuejs)

I recently developed a component with a title and a background color meant to cover the entire page, but it seems to have a top margin that I can't seem to remove. Additionally, I created a footer component that should always stay at the bottom of the ...

Tips on postponing 'next/link' in Next.js

How can I implement a delay for page transitions using Route link in Nextjs Version 12.1.0? <Link href="/"> <a className='logo-home'></a> </Link>{' '} This is the approach I took: In my App.js file ...

Is there a way to set up a global web socket in NextJs?

I recently completed a tutorial on setting up a socket chat app, which I found at the following link: tutorial link. While I have successfully managed to get the system up and running, I'm facing an issue with exporting the front-end socket from the i ...

Interactive state for associated product within list without order

I am currently working on a project that involves an unordered list with separate list items. The menu design includes product images in the top list item and the corresponding product names in the list item below. I have successfully implemented a hover s ...

The system is unable to retrieve the value of the property which is set as null

I'm trying to figure out how to store the input value of name_enter into the variable userName. However, every time I attempt this, I encounter the following console error: Uncaught TypeError: Cannot read property 'value' of null function ...

Creating distinct identifiers for CSS JQ models within a PHP loop

Can anyone assist me in assigning unique identifiers to each model created by the loop? I am currently looping through a custom post type to generate content based on existing posts. I would like to display full content in pop-up modals when "read more" i ...

Encountering difficulty transmitting data from next.js to Supabase because of a primary key issue

My code is designed to capture user input from various input boxes and send it to the corresponding table on Supabase. Below is a snippet of the code: const initialState = { solution_id: '', organization_id: '', budget_usd: '&apos ...

Automatically log out user when token expires in next-auth v4

My implementation involves using Node.js for credentials login on the backend. The login process functions smoothly, but there is an issue with token expiry set to 15 seconds. I intend for the system to automatically log out upon expiration, even if no API ...

Is there a way to line up these two tables or divs using a shared parent header div?

In the process of developing this webpage, I encountered a layout that resembles the following: Here is an approximation of the HTML structure: <div class="title"> <table> <tr> <td width="35%">Table 1a Head ...

Creating CSS rounded corners with pseudo-elements

Take a look at this fiddle: https://jsfiddle.net/xnr7tqm1/ This is the html code I'm working with: <div class="media-container"> <iframe width="365" height="200" src="https://www.youtube.com/embed/JqjIb6FhU_k" frameborder="0" al ...

Struggling to effectively align the footer div in a responsive design

Check out this GitHub link to access the HTML file and CSS: https://github.com/xenophenes/pgopen-splash2016 I'm facing an issue with the footer text alignment. Despite my efforts, I can't seem to center it properly as it keeps appearing slightly ...

How to update the state of a component in the root layout from its child components in Next JS 13 with the app router?

I am in the process of upgrading a Next JS app project to utilize the App Router. Within the layout.js (the root layout), there is a Logo component that will be visible on all routes. Within the RootLayout, I am managing a state variable to modify the ap ...

I believe I am attempting to add some space to a row using CSS, or at least that's what I think I'm trying to achieve

Hey there, I need some help with adding an icon "services" section to my website. CSS is not my strongest suit, so I'm reaching out for assistance. My goal is to create blocks for the icons that don't touch the edge of the page and have a margin ...

Is there a way to dynamically change select2 styling using code when a form is submitted?

Having trouble highlighting empty select2 selects when a form is submitted? I'm struggling to override my existing CSS styling upon document load. Check out my jQuery attempt: var $requiredUnfilledItems = $(".required:not(.filled)"); if ($requiredUn ...

What is the best approach to reverse the selection of <li> elements by utilizing :not() and :contains

I am looking to implement a live search feature using jQuery. Below is the code snippet I have written: $("#searchInput").on("keyup", function () { var searchTerm = $("#searchInput").val(); $('li:contains("' + searchTerm + ' ...

Creating Flexible Divs with Gradient Background for Older Versions of Internet Explorer - IE8 and IE7

I'm attempting to achieve the following. https://i.stack.imgur.com/YYOZv.jpg The issue I am encountering is that the elements in row1 have a different gradient background compared to those in row2. Additionally, row1 is populated dynamically with c ...

Encountering an error while attempting to connect to the NestJs Google VM Server from a Firebase-hosted NextJs application

A NestJS server has been set up as follows: import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import * as fs from 'fs' import * as https from 'https' import * as express from &apos ...

Is it possible for Susy to output a pixel-based span?

As a newbie to Susy, I hope you don't mind if I ask a seemingly silly question... I'm trying to figure out how to calculate responsive padding within a Susy grid. The standard formula is: (target / context) x 100. Is there a way for Susy to pr ...

Error: The function createImageUrlBuilder from next_sanity__WEBPACK_IMPORTED_MODULE_0__ is not defined as a valid function

Having some trouble with my Next.js TypeScript project when integrating it with sanity.io. I keep getting an error saying that createImageUrlBuilder is not a function. See screenshot here Here is the code from my sanity module ...

Tips for positioning label/input box/button on Internet Explorer 7

Here is a Fiddle example you can check out, along with the corresponding code : <div class="menu-alto"> <ul> <li> <a title="Link" href="#">Link</a> </li> <li class="newsletter ...