我有一个web控件按钮在web表单。
在我的代码c#后面,我想把它向左移动10个像素。
怎么做?
我知道你可能不想这样,但使用jQuery或javascript可能是一个很好的选择。
$('button').click(
function(){
$(this).css('margin-left', '-=10px');
});
button {
margin: 0 0 0 200px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>I'm a button</button>
像这样:
Button buttonb = new Button();
buttonb.Attributes.Add("Style", "margin-left:10px");