Skip to content

Padding and margin are not working on Vue.js _ TW v4.0 #15728

Answered by samstorment
ramyus889 asked this question in Help
Discussion options

You must be logged in to vote

I had a similar issue where a lot of my styles seemed to be alright but margin and padding were obviously very wrong. In v3, my main CSS file had reset styles like the ones below. I like to reset all margin and padding to 0 and handle those manually for each element and this worked fine in v3. I think v4 brought quite a few specificity changes because of the substantial use of CSS @layer and this made it so all my elements always had 0 margin and padding, even when using a tailwind class like <div class="p-4"></div>.

@tailwind base;
@tailwind components;
@tailwind utilities;

*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-family:

Replies: 3 comments 14 replies

Comment options

You must be logged in to vote
14 replies
@CodingCookiee
Comment options

@chmiiller
Comment options

@Starco3000
Comment options

@Koipix
Comment options

@haidar47x
Comment options

Answer selected by ramyus889
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet