A considerable number of websites use digital paging effects. For example, the paging of this site also adopts this method, which is quite beautiful to use. The code example is as follows Copy code The code is as follows:<!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"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="author" content="http://www.softwhy.com/" /> <head> <title>Ant Tribe</title> <style type="text/css"> ul { list-style:none; } ul li { float:left; width:22px; height:22px; margin-left:5px; } a { width:20px; height:20px; display:block; text-align:center; text-decoration:none; background-color:white; border:1px solid #666; } a:hover { width:40px; height:30px; border:1px solid #666; position:absolute; line-height:30px; margin:-5px 0 0 -10px; } </style> </head> <body> <ul> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">6</a></li> <li><a href="#">7</a></li> </ul> </body> </html> The above code achieves the desired effect. Here is a brief introduction to the implementation steps : 1. Use the float property to align the li elements horizontally. 2. Set the a elements as block-level elements and then set their sizes. 3. By using the link pseudo-class to control the size of the a element when the mouse is placed on the link, and using absolute positioning, the current a element can cover the surrounding elements. Special note: The reason why the background color of the a element is set to white is because the background is transparent by default. If the background color is not set, you will see the borders on both sides being covered. |
<<: Does Mysql ALTER TABLE lock the table when adding fields?
>>: How to handle long data when displaying it in html
Event Description onactivate: Fired when the objec...
1. Add a hard disk 2. Check the partition status:...
HTML-centric front-end development is almost what ...
Table of contents background Provide / Inject Ext...
Preface The previous article installed Hadoop, an...
introduce RANGE partitioning is based on a given ...
This article records the method of sharing files ...
function 0. Display current time Command: select ...
1. Rounded border: CSS CodeCopy content to clipbo...
Table of contents 1. What is lazy loading of rout...
Table of contents 1. Initialization structure 2. ...
During the front-end development process, a situat...
<meta http-equiv="X-UA-Compatible" c...
Preface When the WeChat mini program project invo...
Preface: This article mainly introduces the conte...