0

我有一个 48x48 的图像,用于图标按钮。我发现我可以使用以下 html 代码将其设为 16x16。

<button>
    <img src="48x48.png"   width="16"  height="16"/>
</button>

但是,如果我改为使用

<!DOCTYPE html>
<html>
<head>
<style>
.actionButton{
    width:16;
    height:16;
}
</style>
</head>

<body>
<button>
    <img src="48x48.png"  class="actionButton"//>
</button>
</body>
</html>

按钮大小始终为 48x48。

4

2 回答 2

4

您需要将单位添加到您的 CSS 中,即px如下所示:

.actionButton{
    width:16px;
    height:16px;
}
于 2013-05-15T17:52:53.010 回答
0

你好,

你可以使用这个:

<img src="48x48.png" style="width=18px; height=18px;" />

或者只是调整图像大小。

于 2013-05-15T17:54:12.970 回答