Home >Web Front-end >HTML Tutorial >Media attribute of Bootstrap css_html/css_WEB-ITnose
The following piece of code is implemented: the maximum width of the device is 767px. When the device width is greater than 767px, the background color is #000, otherwise it is #f00. The code is as follows:
<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Media Queries</title><style>body{background:#000;}@media (max-width:767px){body{background:#f00;}} <!-- 设备最大宽度为767px,当设备宽度大于767px就是#000,否则就是#f00 --></style></head><body></body></html>
CSS Media property
Screen: refers to the computer screen.
Projection: refers to the project used for display.
braille: Braille system, refers to printed matter with tactile effects.
Aural: refers to a speech electronic synthesizer.
tv: refers to television-type media.
handheld: refers to a handheld display device (small screen, monochrome)
all: suitable for all media.