Vuetify Version: 2.0.7
Vue Version: 2.6.10
Browsers: Chrome 76.0.3809.100
OS: Windows 10
Using v-row creates a negative right margin that causes overflows / horizontal scrolling on mobile.
Is there any solution to get rid of this instead of adding ma-0 to every row? Is this the expected functionality?
Thank you!
Should not cause any problems with overflow / horizontal scrolling.
Causes issues with overflows / horizontal scrolling, especially on mobile.
This issues occurs when I use a v-row inside a v-col. Does the v-row ALWAYS need to be inside a v-container? Can't I use v-row inside a v-col for example?
Thanks!
I'm not sure that there have any use case for using row without wrapping col.
Actually, the point of negative margin in row is supported nested columns case when they attract each other. You can see some description from here, Why negative margin in row - Stackoverflow
For my advice, I recommend you to use v-row to wrap v-col that include with your content.
<v-row>
<v-col>
<span>
testing stuff
</span>
</v-col>
</v-row>
Hope that it would be help 馃槑
Thanks,
I now understand why they have negative margins.
But, even if I wrap the contents of a v-row in a v-col, the same issues remain. For example:
<v-col md="9">
<v-row justify="center">
<v-col class="shrink">
/* Button. Other Content.*/
</v-col>
</v-row>
</v-col>
Do I need to wrap the v-row in a v-container? It can't be the direct child of the v-col?
Thanks again!
@VeronicaGavrila
No need to wrap with v-container, but v-col must be wrapped with v-row.
Hey, @runyasak
In the previous example all of the v-cols are wrapped in a v-row but I still get negative margins and overflowing x axis.
I can fix it if I add a v-container, and the full code hierarchy will be something like this:
<v-app>
<v-content>
<v-container>
<v-row>
<v-col>
<v-row>
<v-col>
<--! We are here-->
<v-row>
<v-col>
</v-col>
</v-row>
</v-col>
</v-row>
<v-col>
</v-row>
</v-container>
</v-content>
</v-app>
Is something wrong with the above code that it needs the v-container? If I do not put a v-container where the "We are here" comment is, I will have a negative margin and overflow on X.
Thanks again!
@runyasak
Okay so the issue is not from the way I nested the grid elements but from the additional padding that I added to the last v-col.
For v-container, you will need when you want contents arrange at the center of your site.
I'm not sure about the best practice of container but actually, you can use v-container for some specific area that you want content in the center.
You can read more information from here, Grids usage - Vuetify
Hmm - I'm having the same problem. "Grids usage" is not very helpfull at all but in this special case the "Grids usage" page use most of the time "no-gutter" which sets margin-left to 0.
Here you can see that margin-left is negative by default...
https://github.com/vuetifyjs/vuetify/blob/3a9fdc292af97c98be91c014bde1fac40a96e865/packages/vuetify/src/components/VGrid/_mixins.sass
Most helpful comment
Hmm - I'm having the same problem. "Grids usage" is not very helpfull at all but in this special case the "Grids usage" page use most of the time "no-gutter" which sets margin-left to 0.
Here you can see that margin-left is negative by default...
https://github.com/vuetifyjs/vuetify/blob/3a9fdc292af97c98be91c014bde1fac40a96e865/packages/vuetify/src/components/VGrid/_mixins.sass