Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with compile grid-column less

Tags:

There was a problem with property 'grid-column'


Css:

.someClass {    grid-column: 1 / 4; } 

Less compile it's in css as:

.someClass {    grid-column: 0.25; } 

But it's works well:

.someClass {    grid-column-start: 1;    grid-column-end: 4; } 

How I can use correctly property grid-column with '/' symbol in Less?

like image 287
Valentin Avatar asked Aug 30 '17 10:08

Valentin


People also ask

Is grid column gap deprecated?

'grid-gap' has been deprecated in favor of 'gap'. In a similar vein 'grid-row-gap' and 'grid-column-gap' have been deprecated in favor of 'row-gap' and 'column-gap'. Unfortunately, the new features aren't recognized by Visual Studio yet either. As far as May 2020, 'grid-gap' is shown as "Obsolete" in VSC.

Why is grid-template-columns not working CSS?

The problem is that you are applying the grid-template-columns property to grid items. This is a grid container property. It will be ignored on grid items (unless they are also grid containers). Instead use the grid-column and grid-row properties, which apply to grid items.

How do I keep my grid from overflowing?

To avoid the minimum width/height calculation size, you should therefore set the minimum width or heigth to another value than auto . And as you can see: the first column does not overflow anymore. the two columns share 50% of the space as specified in the fraction.

Why are there gaps in my grid CSS?

The vertical gaps are caused by the images not filling the vertical space in the grid items. The problem is made worse with align-items: center on the container, which removes the align-items: stretch default. Essentially, there are no gaps between grid items.

What are the properties of grid-column-start and grid- column-end?

Property Values: The grid-column-start and grid-column-end, property can be described in three ways: auto: The element will be placed in the default flow. It is default value. span n: It specifies the number of columns item will span in grid-column-start and grid-column-end both cases.

What is the use of grid column in HTML?

Definition and Usage. The grid-column property specifies a grid item's size and location in a grid layout, and is a shorthand property for the following properties: grid-column-start. grid-column-end.

Is it possible to customize grid widths with less?

However, once you’ve already got your download, it can be a real pain to tweak the way the grid works. Because LESS allows you to insert variables into your CSS, we can use it to build a framework that is easily customizable during the development stage. The goal will be to create something that allows custom grid widths with very little effort.

What is the difference between grid_1 and grid_2?

The grid_1 class width is simply set to the columnWidth variable. The grid_2 class is twice as wide and now contains extra gutter space for the new column. These amounts simply increase as you go farther: the column width multiplier increases by one each time and the gutter width multiplier increases by two each time.


2 Answers

You have to escape to "slash" when using LESS:

.somClass {     grid-column: 1 e("/") 4; } 

But if you have the ability to bypass the "Slash" by decomposing the css property than do it (I personally find it a better way). You can also use the "~" sign to escape expressions, like ~"1/4"

like image 157
Marouen Mhiri Avatar answered Oct 20 '22 15:10

Marouen Mhiri


try this

.someClass {   grid-column: ~"1/4"; } 
like image 38
diEcho Avatar answered Oct 20 '22 15:10

diEcho