【发布时间】:2015-11-29 16:05:23
【问题描述】:
我正在尝试使用 CSS 样式表设置我的 React 组件的样式。我想更改边距以更好地分隔我的元素,但我的 div 类似乎被破坏了,或者我没有正确理解这个概念。这是我当前代码的输出:
我想在帐户名称输入框和文本之间添加空格。
这是我的反应:
renderGetAccountName: function renderGetAccountName() {
return (
<Dialog onClose={this.onGetAccountNameClose} height={300}>
<h1 style={dialogHeaderStyle}>
NAME YOUR ACCOUNT
</h1>
<span style={errorMessage}>
It is time to name your new account! Please enter your choice below, and click "OK" when you are finished.
</span>
<div classname="nameInput">
<form id="frm1" action="form_action.asp">
ACCOUNT NAME: <input type="text" name="new-account-name"></input>
</form>
</div>
<Button type='button submit' style={submitStyle}>
OK
</Button>
<span>
<button type="button">Cancel</button>
</span>
</Dialog>
);
}
这是我的 CSS:
.gone
display: none
.contact
.controls
.dropdown-menu
li
border-top: 1px solid #B3B3B3
cursor: pointer
padding-top: 8 px
text-transform: capitalize
text-align: center
height: 44 px
&:hover
background-color: #EEE
.nameInput
margin-top: 50px
margin-left: 50px
【问题讨论】:
-
className 而不是 classname
-
我觉得自己像个白痴,你们是最棒的,谢谢!
标签: javascript html css reactjs