Adding custom styling to a specific HTML tag using Tailwind in v-html

I'm currently using v-html to dynamically insert content inside a div (

<div v-html="item.answer" />
). This content is in the form of a string and may contain <ul> and <li> elements.

Is there a way to style these lists using Tailwind CSS? I was thinking something like [&li]:STYLING=HERE would be ideal, but if there's a better method, I'd love to learn about it.

Answer №1

To style the inner list, you can utilize the .wrapper class along with Tailwind CSS's @apply directive:

<template>
 <div class="wrapper" v-html="item.answer"></div>
</template>

<style>

.wrapper li{
  @apply list-disc list-inside text-green-500;
}
</style>

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 sending PHP array when select changes using jQuery?

In short, I am implementing pagination using a library that displays only 3 <li> elements at a time. Within each of these <li> elements, there is a PHP array used to create a table with 8 rows, showcasing 8 elements from the array using PHP cod ...

Should header and footer be incorporated as part of a template design?

Is it considered advisable to include tags such as etc from another page? For example: <?php include_once("header.php")?> Content specific to each individual page <?php include_once("footer.php")?> The header.php file includes: <!DOCTYP ...

Define a variable using an HTML selector and then verify the presence of elements inside it

One method I use involves creating a variable based on an HTML object. var li = $(this).closest('li'); After creating this variable, I often need to select inner HTML objects from it, such as spans. li.find('span'); However, sometim ...

Utilizing distinct useState for mapped elements

I am struggling to find a solution on how to pass specific useState states to respective mapped elements. export const Polska = () => { const [riverVisible, setRiverVisible] = useState(false) const [mountainVisible, setMountainVisible] = useState(fa ...

Guide on Modifying the CSS File of an Installed Plugin on WordPress

I am looking to customize the design of a WordPress plugin by editing its CSS file. When trying to locate the CSS file of the installed plugin through Plugins --> Installed Plugin --> Editor, I could only find .php files instead of the desired CSS f ...

Error during compilation due to a missing parenthesis in the loop structure

I've been experimenting with creating a carousel using just html and css, without any Javascript. I've been exploring resources on the web and following tutorials to achieve this goal. However, I've encountered an issue. I created a mixin l ...

Another way to display mjpeg using an img tag and Basic Authentication

Recently, there was an update in Chromium that included a new security measure. This update now prohibits the use of basic authentication in elements like the source attribute of an Image element. For more information on this change, you can visit https:// ...

Struggling with a $ref that points to a Proxy object within vue-router

After transitioning from using VueJS in browser mode to a VueJS SPA with vue-router, I am facing issues with my code as $refs is no longer functioning correctly. Previously, I was able to interact with my Google Charts by referencing the graph (this.$refs ...

Undisclosed iFrame technique for uploading files - issue with nested forms

This question seems to be more related to JavaScript/jQuery/DOM rather than Rails, but it's all linked to how I integrated it in Rails. I'm currently working on allowing users to upload multiple photos while creating a new object (auction). The c ...

Is there an HTML editing tool that has the ability to collapse code blocks by tags and rearrange them?

I'm in search of a text editor or IDE that includes syntax highlighting and allows me to collapse HTML code blocks by tag. I currently use Eclipse, but its "folding" feature only works on top level tags like TABLE, not child tags like TD and TR. Are t ...

Develop a personalized mapping API with a unique image integration for website navigation

Currently, I am in the process of developing a website for my university that will allow users to easily locate all available free food options on campus. My goal is to create a platform where food providers can register their events, have them saved in a ...

Upgrade your Vue 2 app with the magical powers of Vue 3 Teleport

By utilizing the teleport feature in Vue 3, you can move a component to the body tag with ease: <template> <button @click="modalOpen = true"> Open full screen modal! (With teleport!) </button> <teleport to=&quo ...

Switch up the perspective/component without altering the URL

I have implemented a 404 error page functionality successfully using VueRouter: const router = new VueRouter({ routes: [ // ... { path: '*', component: NotFound, name: '404', ...

Unexpected issue encountered for identifiers beginning with a numerical digit

Is it possible to select an element from a page with an id that begins with a number? $('#3|assets_main|ast_module|start-iso-date') Upon attempting to do so, the following error occurs: Uncaught Error: Syntax error, unrecognized expression: ...

Struggling to find element - Python Selenium

Having trouble finding the HTML element using Python Selenium as I keep receiving error message saying: "Unable to locate element." The code I'm currently using is: browser.find_element_by_id("X14Edit") Below is the snippet of HTML code: ...

Hiding Borders on HTML Pages

I am struggling to hide the borders of my tables despite adding CSS code for it. table { display: table; width: 100%; border-collapse: collapse; border-spacing: 0; border: 0px; outline: none; } th, td { padding: 5px 10px; border: 0px; ...

Discover the moment HTML5 audio stops playing or when a track is completed by utilizing jQuery

I'm currently working on implementing an HTML5 audio tag and I am looking for a way to trigger an event once the song has finished playing. Is there a way to achieve this using jQuery? This is my jQuery code: $(document).ready(function(){ var mu ...

arrange fixed-top elements in a stacked manner using Bootstrap 4

I am looking to inform users about enabling JavaScript for optimal use of the website, and I want this message to appear above the navigation bar using Bootstrap. However, currently they are stacking on top of one another instead of displaying in the desir ...

Is there a tool available that can provide links to all websites within a specific domain?

Can all the links from a given URL be extracted to understand the structure of a website? For instance: www.samplewebsite.com www.samplewebsite.com/page1.aspx www.samplewebsite.com/page2.aspx www.samplewebsite.com/page3.aspx www.samplewebsite.com/page1.a ...

What causes the CSS width property to vary when using the display:inline property?

There is a piece of code that contains a <ul> element with the default css property display:block. Here is the code snippet: ul,li{ list-style-type:none; padding:0; /*display:inline;*/ } #parent{ width:100%; /*height:50px;*/ background-color ...