Skip to content

Support for recently added CSS functionality container-queries #3766

Closed
puckowski/less.js
#1
@sneridagh

Description

@sneridagh

As pointed out by @treponat, it seems support for @container queries should be implemented in less.

By tomorrow (12/12/2022) Firefox will release 108 with support for container queries, completing all the major browsers support for the feature.

Discussed in #3759

Originally posted by treponat November 3, 2022
Recently some of the browser started to support a new feature that would allow to create responsive design based on the parent element rather than client's viewport.
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Container_Queries
It would be wonderful if LESS would also start to fully support this feature.
Currently you can use container functionality in .less files, but the hierarchical structure of css blocks is not working as expected for the container syntax.
for example

.widget.discoverresults, .widget.repositoriesresults {
        container-type: inline-size;
        @container (max-width: 350px) {           
                    .cite {
                        .wdr-authors {
                            display: none;
                         }
                }
         }
}
    

would produce this css blocks

.widget.discoverresults,
.widget.repositoriesresults {
  container-type: inline-size;
}
@container (max-width: 350px) {
  .cite .wdr-authors {
    display: none;
  }
}

instead of

.widget.discoverresults,
.widget.repositoriesresults {
	container-type: inline-size;
}

@container (max-width: 350px) {

	.widget.discoverresults,
	.widget.repositoriesresults {
		.cite .wdr-authors {
			display: none;
		}
	}
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions