0

asp.net Webアプリケーションを開発していて、画像ボタンコントロールがいくつかありますが、視覚的なクリックをシミュレートするにはどうすればよいですか?イベントをトリガーするという意味ではなく、通常のボタンのようにボタンが押されていることを視覚的に確認するだけです。

4

1 に答える 1

1

cssタグを使用できます。このlivedemoを参照してください:http://img.usabilitypost.com/0812/active_button/index.html

ここでの手順: http ://www.usabilitypost.com/2008/12/16/pressed-button-state-with-css/

編集:簡単にするためのコード。

<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>Button Test</title>
    <style type="text/css" media="screen">
        body {
            padding: 40px;
        }
        #button {
            display: block;
            width: 135px;
            height: 43px;
            background: url(button.png) no-repeat top;
        }
        #button:active {
            background: url(button.png) no-repeat bottom;
        }
    </style>
</head>

<body>
    <a id="button"></a>
</body>

また、CSSに非常に慣れておらず、実際に車輪の再発明をしたくない場合は、TwitterのBootstrapのようなベースcssインターフェイスを使用できます:http ://twitter.github.com/bootstrap/base-css.html#buttons

于 2012-07-12T22:05:53.953 に答える