我需要你的帮助。试图弄清楚如何在我的页面周围放置边框。这是我的html和css
<html>
<head>
<title>Royal Aura club</title>
<link rel="stylesheet" type="text/css" href="restyle.css" / >
</head>
<body>
<main id="main">
<div id="header">
<h1> Royal Aura club</h1>
<div id="nav">
<div class="navitem"><a href="#">Home</a></div>
<div class="navitem"><a href="#">Restaurant </a></div>
<div class="navitem"><a href="#">Gallery</a></div>
<div class="navitem"><a href="#">Guest list</a></div>
</div> <div class="navitem"><a href="#">Job Vancancies</a></div>
<div id="content">
<div id="textblock">
<h2>Why Royal Aura?</h2>
<p>
Royal Aura club and restaurant is located in Mayfair just a walk away from the Ritz.
We will guarantee you will have a ball of a time with our brilliant DJ playing the tunes while your sipping cocktails away and dancing the night away.
<p>
Aura is a glamorous and sophisticated club that has a beautiful decor to get the mood. If you fancy doing VIP in style drop us a e-mail, we will be glad to help. Not to mention our fabulous food dishes we serve are to die for.
Please make sure you e-mail us 24 hours before the day you want to come and party or dine.
</p>
</div>
</body>
</html>
Css-
body {
front-family: verdana, arial, sans-serif;
margin:0;
padding: 0;
background-color: #FFFDED;
border:0px;
}
#main {
background-color: #FFFFFF;
width: 280px;
margin: 50px auto;
border: 0px solid;
}
#header {
border-bottom:none
}
#content {
padding: 6em 1em;
border: none;
margin: 20px;
}
#footer {
}
h1 {
font: bold 1.5em Tahoma, arial, sans-serif;
color: #826BA9;
font-style: italic;
background-image: url(relogo.jpg);
background-repeat: no-repeat;
padding: 1em 1em 1em 120px;);
background-repeat: no-repeat;
padding: 1em 1em 1em 100px;
}
.navitem {
float: left;
border-right: 3px solid #999999;
border-top:1px solid #999999;
text-align: left;
}
#textblock {
background-color: #D4CAE2;
width: 300px;
border: 4px solid #000000;
padding: 10px 7px;
float: left;
font-size: 110%;
text-align: left;
height: 400px
}
a:link {
text-decoration: none;
color: #000000;
padding-left: 0.em;
padding-right: 0.5em;
float: right;
}
a:visited {
text-decoration: none;
color: #826BA9;
padding-left: 0.5em;
padding-right: 0.5em;
}
a:hover {
text-decoration: none;
color: #826BA9;
background-color: #F4E8F0;
display: block;
}
谢谢x
答案 0 :(得分:6)
body {
border: 5px solid red;
}
答案 1 :(得分:2)
我认为<main>
不是有效标记。另外,请务必关闭代码。
替换它:
</body>
</html>
有了这个:
</div>
</div>
</body>
</html>
并替换它:
<main id="main">
有了这个:
<div id="main">
最后,替换它:
#main {
background-color: #FFFFFF;
width: 280px;
margin: 50px auto;
border: 0px solid;
}
用这个:
#main {
background-color: #FFFFFF;
width: 280px;
margin: 50px auto;
border: 1px solid red; /* width, style, colour */
}
并相应地更改border属性。
如果您想要整个页面的边框,请将该边框属性放在CSS中的body{}
内。
答案 2 :(得分:2)
这就是你需要做的所有事情:
html{
border: solid;
}
答案 3 :(得分:2)
尝试一下,不会说出正确的方法
body {
background-color: green;
border: 5px solid white;
padding: 100%;
margin: 0;
}
答案 4 :(得分:0)
您需要调整属性以匹配您想要的结果,但这应该在您的页面周围放置边框。
#main {
border: 1px solid red;
}
答案 5 :(得分:-1)
我认为,如果您的主容器280px的宽度并且您想要为您的页面添加边框(而不是您的所有容器div);你的身体类应该是这样的
body {
border: 5px solid red;
width:100%;
height:100%;
display:block;
overflow:hidden;
}