Issue with spacing between elements in Tailwind/Nuxt - elements appear too close together

There seems to be a spacing issue when using tailwind v3.4.3 on the Tailwind Playground, with extra space added between span elements.

<div>
  <p>
    <span class="bg-slate-800">TEST</span>
    <span class="bg-orange-600">TEST 2</span>
    <span class="bg-yellow-500">TEST 3</span>
  </p>
</div>

If you copy and paste the above code on play.tailwindcss.com, you can see the additional space between span elements.

https://i.sstatic.net/8MM5lzjT.png

However, when attempting a similar setup in Nuxt 3 with Tailwind installation, the space between span elements is missing.

https://i.sstatic.net/V0LeNsqt.png

I have already configured Nuxt and Tailwind settings, as seen in this editor link.

Even after installing Tailwind using Nuxt modules '@nuxtjs/tailwindcss', the issue remains unresolved.

Currently in the process of migrating my project from Nuxt 2 to Nuxt 3, where Nuxt 2 exhibited behavior similar to Tailwind CSS Playground, but in Nuxt 3 it's causing issues.

Resolving this spacing problem would greatly benefit the project.

Answer №1

To customize the compilation of Vue Single File Components (SFCs), you can adjust the whitespace settings in nuxt.config.ts

export default defineNuxtConfig({
  vue: {
    compilerOptions: {
      whitespace: 'preserve'
    }
  }
})

Note that if you are not using Nuxt, the configuration change will be slightly different in vite.config.ts

export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          whitespace: 'preserve'
        }
      }
    })
  ]
})

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

What is the reason for the disappearance of unordered list bullets when using padding: 0?

Updating an older website that contains numerous unordered lists has presented a challenge. When the padding is set to 0, the display markers on the unordered list disappear. The root cause of this issue was traced back to the CSS setting *{padding: 0; ma ...

Tailored Bootstrap form styles for different screen sizes

Can someone please help me understand how to create a custom Bootstrap class that applies to a specific breakpoint? I've tried using w-md-50, w-sm-100, w-lg-75 for a form, but it doesn't seem to be working for the targeted breakpoint. Are there a ...

Create a CSS header with a fading background that extends horizontally to the left and right

I'm looking to create a header with a unique color transition effect - a left fade from light blue to blue, a center that is solid blue, and a right fade from blue to light blue. The header should span the full width of the page. Can anyone suggest th ...

Is there a way to ensure that the background position remains stable and does not shift or collapse?

Still getting the hang of all this, but I'm making progress by learning on the go and enrolling in courses. Sometimes I face small obstacles like the one I'm encountering now. Everything looks great when the browser is at 100%, but when I minimi ...

Tips for utilizing javascript to reset the heightline of the preceding keyword during a keyword search

Using JavaScript, I have implemented a search keyword function that highlights specific words in a paragraph. However, I am facing an issue. Currently, when searching for the next keyword, the previously highlighted text remains in red instead of reverting ...

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 ...

C#: Issues with loading static content in MVC on various environments with IIS

Within my C# MVC 4.5 Website, I recently introduced a new folder to host CMS-type applications separately from the main site. While everything seemed fine during local testing, issues arose after deploying the updates to the DEV environment. A closer look ...

Expand the accordion to reveal all the content

I'm facing an issue with my accordion where a scrollbar appears in every content section. To fix this, I tried setting overflow: hidden in the CSS: .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: hidd ...

Styling X and Y axis font color in charts using JavaFX 2.x CSS

Is there a way to change the font color of both X and Y axes? In my search through the css reference for fonts, I only found properties like font-size, font-style, and font-weight. font-size, font-style and font-weight I attempted to use -fx-font-color ...

Why is it that a click event outside of an HTML element cannot be detected in this Vue 3 application?

I've been diving into building a Single Page Application using Vue 3, TypeScript, and The Movie Database (TMDB). Currently, I'm focused on developing a search form within my project. Within the file src\components\TopBar.vue, here&apo ...

Prevent Nuxt from refreshing the page when the URL is modified

Currently, I am in the process of transitioning an application to Nuxt3 and encountering an issue regarding page reloading when the URL changes. Within my application, I have multiple links that all lead to the same page. To address this issue, I had to ma ...

html - displaying a new page within the content of the current page

I have a question about basic HTML knowledge that I find embarrassing Is it possible to open or load a second page within my first page? I want a menu button that will load the second page. <li class="current"><a href="first.html" target = "myC ...

``The issue concerning the preloading layer on the website``

My experience with the website www.wirecreation.net is sometimes marred by an issue during the initial load. It seems that there is a margin of a few pixels on the gray div containing the logo and progress bar at times, but other times it appears with zero ...

Aligning an Image Vertically

I'm working with a document structure that includes an unordered list containing div elements with images inside. The images have a set height of 150px, but sometimes the images are smaller than that. Is there a way to vertically position the images w ...

Creating a fading effect on an image in relation to another dynamic image

I am currently facing an issue in my code where I am trying to make one image fade in next to another, regardless of the position of the movable image on the screen. The movable image can be controlled using arrow keys, and when I move it across the screen ...

Implementing React with Tailwind and AOS to Enhance User Experience

I recently utilized the React Tailwind template to develop a website. It functions flawlessly in my browser with no issues when running npm start. However, I encountered errors while attempting to deploy it on Netlify or Heroku despite following the docume ...

What is the method for adjusting the subheader color on a Material UI card component?

How can I change the subheader text color to white in a Material UI Card with a dark background? Here is my code: const useStyles = makeStyles(theme => ({ menuColor: { backgroundColor: theme.palette.primary.main, color: '#ffffff', ...

Show both text and image inputs side by side within a table

Hey there, I'm trying to create a table with both text and image inputs inside. Here's the code I've attempted: <tbody> <tr> <td class="inputs"> <input type=" ...

Creating a custom jQuery and HTML5 application for the WP8 device (specifically the Lumia 920) with a GWT framework that addresses the vertical CSS

Issue: I am facing an issue with scrolling out of application boundaries and trying to find a solution: (Image source: Prevent scrolling out of CordovaView in Cordova for Windows Phone 8 ) Method #1 body { overflow: hidden; -ms-content-zooming: ...

Default Link Color Being Utilized by Blog Title

My website was created using a theme (HTML, CSS, JavaScript), but the Blog Title is stuck with the default link color. I've attempted several methods to change the Title color without success. What's the solution for changing the Title color? ...