How to solve the problem of css3 media not working
Solution: 1. Make sure the media writing format is "@media screen and (css style){}"; 2. Check whether the styles conflict; 3. Set the viewport attribute of the meta tag; 4. Media is followed by The content in brackets cannot contain the ending character ";". If there is any, it needs to be removed.
#The operating environment of this tutorial: Windows 7 system, css3 version, Dell G3 computer.
css3 @media does not work Summary of reasons
First confirm whether it is a problem with the css itself, rather than the media query not taking effect; for example
div{display:flex;}/*那么div所有的display效果都将无法生效*/
The external style introduces the src used in css, and it is a careless mistake
<link src="/css/imgpro.css" rel="stylesheet" > /*这是错误的*/ <link href="/css/imgpro.css" rel="stylesheet" >/*这是正确的*/
If it is a css problem, we can only analyze the specific problem in detail.
Please follow the following errors to troubleshoot.
The first error: the format is written incorrectly and there must be a space after it. For example, the following code;
@media screen and (max-width:500px){ }
The second error: style conflict; the style of the @media query code is overwritten by the subsequent css
Note: It is recommended that in the process of writing css, the css with @media query is written at the back to avoid being overwritten by the previous css
The third error: There is a problem with the css itself Causes css to not take effect
Note: This is a very common error. For example, the floating block element causes the parent element to have no height. At this time, adding a background color to the parent element does not take effect. It is actually caused by css. The error is not displayed.
For example, the priority of css selection will also cause one of them to take effect and the other not to take effect. There are many problems caused by css errors, so I will not list them one by one.
The fourth error: meta attribute viewport attribute, although this is basic common sense, some people may miss it
<meta name="viewport" content="width=device-width, initial-scale=1" />
The fifth error: the content in brackets cannot write the end character ";" , and other errors.
Related recommendations: css video tutorial
The above is the detailed content of How to solve the problem of css3 media not working. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to achieve wave effect with pure CSS3? This article will introduce to you how to use SVG and CSS animation to create wave effects. I hope it will be helpful to you!

Some users encountered the problem that checking media cannot be started when starting a Lenovo laptop, which is confusing. So how to solve the problem of checking media not starting on Lenovo computers? This tutorial will bring you the reasons and solutions for checking media failing to start on Lenovo laptops. Causes: 1. Hard drive damage: If the Lenovo notebook has hard drive damage or failure, it will cause the notebook to display checking media and not boot. The operating system is damaged: If the operating system of a Lenovo notebook is damaged, it will cause the notebook to display checking media and be unable to boot. 2. Restart the computer, press F12 to enter the BIOS, and select the "Startup" item.

This article will show you how to use CSS to easily realize various weird-shaped buttons that appear frequently. I hope it will be helpful to you!

Two methods: 1. Using the display attribute, just add the "display:none;" style to the element. 2. Use the position and top attributes to set the absolute positioning of the element to hide the element. Just add the "position:absolute;top:-9999px;" style to the element.

In CSS, you can use the border-image attribute to achieve a lace border. The border-image attribute can use images to create borders, that is, add a background image to the border. You only need to specify the background image as a lace style; the syntax "border-image: url (image path) offsets the image border width inward. Whether outset is repeated;".

How to create text carousel and image carousel? The first thing everyone thinks of is whether to use js. In fact, text carousel and image carousel can also be realized using pure CSS. Let’s take a look at the implementation method. I hope it will be helpful to everyone!

Implementation method: 1. Use the ":active" selector to select the state of the mouse click on the picture; 2. Use the transform attribute and scale() function to achieve the picture magnification effect, the syntax "img:active {transform: scale(x-axis magnification, y Axis magnification);}".

The animation effect in css3 has deformation; you can use "animation: animation attribute @keyframes ..{..{transform: transformation attribute}}" to achieve deformation animation effect. The animation attribute is used to set the animation style, and the transform attribute is used to set the deformation style. .
