I want to use a picture as a link. When the mouse moves over the picture, the corresponding layer will pop up under the picture. Similar to the Want Want customer service module on Taobao, when the mouse moves over the Want Want icon, the corresponding Want Want list will pop up below! Now I want to use CSS to write without JS code. I don’t know how to implement it. Is there any expert who knows about it and can give me some ideas? It’s best if they can give me an example! Thank you so much! Thanks!
Reply to the discussion (solution)
They are all written in js
I don’t know how to do it. It seems that it can be achieved using CSS hiding. Yes, but I don’t know how to operate it!
I don’t think it is possible with pure css. Anyway, I have never written it or seen it.
There is a pure CSS div pop-up menu in my resources for your reference.
I don’t know how to do it. It seems that it can be achieved using CSS hiding, but I don’t know how to do it!
You can use overflow:hidden and overflow:auto to switch between hiding and showing.
How to implement the code!
It can be implemented, but it will be too big. ,
You think the css is the css of the label, and each label has its own css. You can't control the style of the submenu with the css on the main menu, right? Right?
This can only be achieved through other methods. For example, the submenu is divided into two parts. The upper part covers the main menu and is transparent, and the lower part is the submenu function. At the beginning of debugging, the height of this layer is the same as the main menu. When the mouse moves above, the height of the layer is changed to the height of the main menu and submenu.
And your layer must be absolutely positioned, otherwise the submenu will be displayed and the content under the menu will be pushed downwards. This is ugly.
Just implement the code yourself.
Let’s use js to implement it. There is no need to complicate simple problems.
How is it possible to write it in css? ? ? I just wrote a jquery, take a look
</script> <script type="text/javascript"> $(document).ready(function(){ $(".flipa").click(function(){ $(".panela").slideToggle("slow"); }); }); $(document).ready(function(){ $(".flipb").click(function(){ $(".panelb").slideToggle("slow"); }); }); $(document).ready(function(){ $(".flipc").click(function(){ $(".panelc").slideToggle("slow"); }); }); $(document).ready(function(){ $(".flipd").click(function(){ $(".paneld").slideToggle("slow"); }); }); </script>
div.panela,.panelb,.panelc,.paneld,p.flipa,p.flipb,p.flipc,p.flipd { margin:0px; padding:5px; text-align:center; background:#e5eecc; border:solid 1px #c3c3c3; } div.panela,.panelb,.panelc,.paneld { width:220px; height:120px; display:none; } p.flipa,p.flipb,p.flipc,p.flipd { width:220px; height:20px; }
</div> <p>请输入密码:</p> <input type="password" id="pwd" /><p /> <div class="panela"> <p><a href="">百度一下</a></p> <p><a href="">百度一下</a></p> </div> <p class="flipa" id="a">请点A</p> <div class="panelb"> <p><a href="">百度一下</a></p> <p><a href="">百度一下</a></p> </div> <p class="flipb" id="b">请点B</p> <div class="panelc"> <p><a href="">百度一下</a></p> <p><a href="">百度一下</a></p> </div> <p class="flipc" id="c">请点C</p> <div class="paneld"> <p><a href="">百度一下</a></p> <p><a href="">百度一下</a></p> </div> <p class="flipd" id="d">请点D</p>
I am a newbie too! It’s so complicated to write!
Thanks! Learn from each other!
How can it be written in css? ? ? I just wrote a jquery code, take a look
JScript code
first. The object is set to absolute positioning, out of the document flow, and the disable attribute is set to invisible
<div id="outer"> <a href="url"><img src="/static/imghwm/default1.png" data-src="url" class="lazy" / alt="Problem with pop-up layer written in pure CSS_html/css_WEB-ITnose" ></a> <div id="inner"> <ul> <li></li> <li></li> <li></li> </ul> </div></div>Then the key point:
The above CSS code uses the pseudo class :hover externally For div elements, theoretically: hover can be used on any element.
If not, the following should work:
#inner { position:absolute; visibility:hidden;}
The above uses the adjacent sibling selector, which should work. 🎜> The above is all entered manually, there may be errors, but the idea should be fairly clear
#out:hover #inner{ visibility:visible; top:10px; left:10px;}
I personally tested it, and the poster copied it to have a look. The effect is quite rough, but the essence. It’s obvious.
a:hover+#inner{ visibility:visible; top:10px; left:10px;}a:hover div{} can be achieved using CSS. . Set the image as the background image.
Let me show you a demo! Pure CSS display and hide
Just look at the source file.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <meta name="author" content="" /> <style type="text/css"> *{ margin: 0; padding: 0; width: 100px; } #out{ border-style: solid; } #inner{ visibility: hidden; position: absolute; } #out:hover #inner{ visibility: visible; top: 20px; } </style> <title>Untitled 1</title></head><body><div id="out"> <a href="http://www.hao13.com">hello!</a> <div id="inner"> <ul> <li>nihao1</li> <li>nihao2</li> <li>nihao3</li> </ul> </div></div></body></html>
Let me show you a demo! Pure CSS display and hide
You can get the effect you want by looking at the source code.

To build a website with powerful functions and good user experience, HTML alone is not enough. The following technology is also required: JavaScript gives web page dynamic and interactiveness, and real-time changes are achieved by operating DOM. CSS is responsible for the style and layout of the web page to improve aesthetics and user experience. Modern frameworks and libraries such as React, Vue.js and Angular improve development efficiency and code organization structure.

Boolean attributes are special attributes in HTML that are activated without a value. 1. The Boolean attribute controls the behavior of the element by whether it exists or not, such as disabled disable the input box. 2.Their working principle is to change element behavior according to the existence of attributes when the browser parses. 3. The basic usage is to directly add attributes, and the advanced usage can be dynamically controlled through JavaScript. 4. Common mistakes are mistakenly thinking that values need to be set, and the correct writing method should be concise. 5. The best practice is to keep the code concise and use Boolean properties reasonably to optimize web page performance and user experience.

HTML code can be cleaner with online validators, integrated tools and automated processes. 1) Use W3CMarkupValidationService to verify HTML code online. 2) Install and configure HTMLHint extension in VisualStudioCode for real-time verification. 3) Use HTMLTidy to automatically verify and clean HTML files in the construction process.

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1
Powerful PHP integrated development environment

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

WebStorm Mac version
Useful JavaScript development tools
