cuốn sách gpt4 ai đã làm

CSS 媒体查询 : max-width OR max-height

In lại Tác giả: Walker 123 更新时间:2023-11-28 10:35:11 27 4
mua khóa gpt4 Nike

在编写 CSS 媒体查询时,有什么方法可以用“或”逻辑指定多个条件吗?

Tôi đang cố gắng làm một cái gì đó như thế này:

/* This doesn't work */
@media screen and (max-width: 995px OR max-height: 700px) {
...
}

câu trả lời hay nhất

使用逗号指定两个(或多个)不同的规则:

@media screen and (max-width: 995px), 
screen and (max-height: 700px) {
...
}

từ https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries

Commas are used to combine multiple media queries into a single rule. Each query in a comma-separated list is treated separately from the others. Thus, if any of the queries in a list is true, the entire media statement returns true. In other words, lists behave like a logical or operator.

关于CSS 媒体查询 : max-width OR max-height,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23373619/

27 4 0
Walker 123
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress