W3C中文教程
全球最大最新的中文 Web 技术教程
HTML CSS SQL PHP COLORS MYSQL BOOTSTRAP
 

W3.CSS 警告框



显示警告

×

Danger!

Red often indicates a dangerous or potentially negative action.

×

Warning!

Yellow and orange often indicates a warning that might need attention.

×

Success!

Green often indicates a successful or positive action.

×

Info!

Blue often indicates a neutral informative change or action.

警告框是由 w3-container 类和颜色组成的容器:

Example

<div class="w3-container w3-red">
  <h3>Danger!</h3>
  <p>Red often indicates a dangerous or potentially negative action.</p>
</div> 
尝试一下 »

W3.CSS 颜色

警告通常以强烈的颜色显示,但可以使用任何颜色:

Danger!

Red often indicates a dangerous or potentially negative action.

Warning!

Yellow often indicates a warning that might need attention.

Success!

Green often indicates something successful or positive.


Danger!

Warning!

Success!



关闭警告

要关闭这些容器,请单击右上角的 X :

×

Danger!

Red often indicates a dangerous or potentially negative action.

×

Warning!

Yellow often indicates a warning that might need attention.

×

Success!

Green often indicates a successful or positive action.

关闭警告可以使用 w3-closebtn 上的 onclick 事件进行关闭:

Example

<span onclick="this.parentElement.style.display='none'" class="w3-closebtn">x</span>
尝试一下 »

圆角警告

如果您想要圆角类型的警告框,可使用 w3-round 类:

w3-round

w3-round-large

w3-round-xxlarge

Example

<div class="w3-container w3-green w3-round">
尝试一下 »

卡片警告

w3-card-8

Example

<div class="w3-container w3-red w3-card-8">
尝试一下 »