首页
CSS
CSS 显示
尝试一下:显示更多显示类型
运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> p { background-color: blue; padding: 10px; } span { background-color: red; color: white; padding: 10px; } p.ex1 {display: none;} p.ex2 {display: inline;} p.ex3 {display: block;} p.ex4 {display: inline-block;} p.ex5 {display: flex;} p.ex6 {display: grid;} </style> </head> <body> <h1>The display Property</h1> <h2>display: none:</h2> <p class="ex1"> <span>Text 1</span> <span>Text 2</span> <span>Text 3</span> </p> <h2>display: inline:</h2> <p class="ex2"> <span>Text 1</span> <span>Text 2</span> <span>Text 3</span> </p> <h2>display: block:</h2> <p class="ex3"> <span>Text 1</span> <span>Text 2</span> <span>Text 3</span> </p> <h2>display: inline-block:</h2> <p class="ex4"> <span>Text 1</span> <span>Text 2</span> <span>Text 3</span> </p> <h2>display: flex:</h2> <p class="ex5"> <span>Text 1</span> <span>Text 2</span> <span>Text 3</span> </p> <h2>display: grid:</h2> <p class="ex6"> <span>Text 1</span> <span>Text 2</span> <span>Text 3</span> </p> </body> </html>