HTML 5--Controlling the Visbility of Elements

mac2022-06-30  22

1.Display:none/block/inline

2.Visibility :hidden/visible

示例代码:

1 <!DOCTYPE html> 2 <html> 3 <head> 4 <style> 5 h2{visibility:hidden;} 6 </style> 7 </head> 8 <body> 9 <h1>Welcome to BookYourHotel website</h1> 10 <h2>This site is very user friendly.</h2> 11 <h3>You can book your hotel while sitting at home.</h3> 12 </body> 13 </html>

 

测试结果:

*隐藏 h2 后面的部分

 

转载于:https://www.cnblogs.com/Catherinezhilin/p/8971330.html

最新回复(0)