Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: grid gaps not working #494

Closed
3 tasks done
iozuniga opened this issue Aug 12, 2024 · 2 comments
Closed
3 tasks done

[Bug]: grid gaps not working #494

iozuniga opened this issue Aug 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@iozuniga
Copy link

Before submitting...

Context

Row 'gap' clause is not woking.

Current Behavior

The gap value is not working. Always uses the gap default value 1.5em

Expected behavior

should set gap value to zero, but it does not

Possible Solutions or Causes

I saw in materialize CSS that the rule is:
.row. g-0 {
gap: 0;
}

But I believe it should be without the middle space between '.row' and 'g-0'.

Steps to reproduce

Open this link:
https://www.ozs.es/tests/test.html

Source code:

!DOCTYPE html>

<title>XaWeb</title>

1

2

3

<script src="https://cdn.jsdelivr.net/npm/@materializecss/materialize@2.1.0/dist/js/materialize.min.js"></script>

Your Environment

@iozuniga iozuniga added the bug Something isn't working label Aug 12, 2024
@Kam3leoN
Copy link

Kam3leoN commented Aug 29, 2024

i'm french, sorry for my english ;)
this code work correctly in my version et eliminate the repetition in the code.
just grid with GAP idem setting
`
@use "sass:math";

// Mixins to eliminate code repetition
@mixin reset-offset {
margin-left: auto;
left: auto;
right: auto;
}

@mixin grid-classes($size, $i, $perc) {
&.offset-#{$size}#{$i} {
margin-left: $perc;
}
&.pull-#{$size}#{$i} {
right: $perc;
}
&.push-#{$size}#{$i} {
left: $perc;
}
}

.row {
--gap-size: 1.5rem!important; // default gap size

display: grid;
grid-template-columns: repeat(12, 1fr);
gap: var(--gap-size);

//--- Gap
&.g-0 {
gap: 0;
}
&.g-1 {
gap: calc(0.25 * var(--gap-size));
}
&.g-2 {
gap: calc(0.5 * var(--gap-size));
}
&.g-3 {
gap: calc(1 * var(--gap-size));
}
&.g-4 {
gap: calc(1.5 * var(--gap-size));
}
&.g-5 {
gap: calc(3 * var(--gap-size));
}

//--- S
@for $i from 1 through 12 {
.s#{$i} {
grid-column: auto / span #{$i};
}
.offset-s#{$i} {
grid-column-start: #{$i + 1};
}
}

//--- M
@media #{$medium-and-up} {
@for $i from 1 through 12 {
.m#{$i} {
grid-column: auto / span #{$i};
}
.offset-m#{$i} {
grid-column-start: #{$i + 1};
}
}
}

//--- L
@media #{$large-and-up} {
@for $i from 1 through 12 {
.l#{$i} {
grid-column: auto / span #{$i};
}
.offset-l#{$i} {
grid-column-start: #{$i + 1};
}
}
}

//--- XL
@media #{$extra-large-and-up} {
@for $i from 1 through 12 {
.xl#{$i} {
grid-column: auto / span #{$i};
}
.offset-xl#{$i} {
grid-column-start: #{$i + 1};
}
}
}
}
`
image

image

@iozuniga
Copy link
Author

Great! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants