我有一个div
在其中有3个单选按钮我的html页面:
<html>
<head>
<link href="CSS/mystyle.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="outside">
<div id="inside">
<input type="radio"> apple
<input type="radio"> orange
<input type="radio"> banana
</div>
<div id="others"></div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我的CSS位于CSS目录下,
CSS/mystyle.css:
#inside{
font-size:12px;
border-color:#ff3366;
width: 300px;
height: 50px;
}
Run Code Online (Sandbox Code Playgroud)
的width
,height
并且font-size
被成功设置,但border-color:#ff3366;
不显示了,为什么?为什么我无法为div设置边框颜色?
- - - - - - - - - - 更多 - - - - - - - - - - -
顺便说一句,如何将我的内部div(id ="inside")定位到外部div的右侧,与外部div的最右边界约100px的边距?
tw1*_*w16 32
你需要设置一个border-style
.实例:http://jsfiddle.net/tw16/qRMuQ/
border-color:#ff3366;
border-width: 1px; /* this allows you to adjust the thickness */
border-style: solid;
Run Code Online (Sandbox Code Playgroud)
这也可以用速记写成:
border: 1px solid #ff3366;
Run Code Online (Sandbox Code Playgroud)
更新:要#inside
向右移动,您需要float:right
添加一个margin-right: 100px
.实例:http://jsfiddle.net/tw16/qRMuQ/
#outside{
overflow:auto;
}
#inside{
font-size:12px;
border-color:#ff3366;
border-width: 1px;
border-style: solid;
width: 300px;
height: 50px;
float: right; /* this will move it to the right */
margin-right: 100px; /* this applies the 100px margin from the right */
}
Run Code Online (Sandbox Code Playgroud)