我遇到一些问题,让我的背景img显示在我的网站上,或者如何修复col#1中的标签框以匹配网站的宽度。 我没有想法如何调整我的网站,以实现所需的显示外观。 字体和文本只是我自己版本中的占位符,但这是我的代码:
body {
background-image: url("taustakuva.png");
background-repeat: no-repeat;
background-position: left bottom;
width: 560px;
}
#content {
padding: 0;
margin: 0;
width: 100%;
height: 300px;
background-color: #e3f6fc;
border-style: solid;
border-widtH: 5px;
border-color: #add8e6;
}
#header {
padding: 0px 0px 4px 4px;
margin: 0;
color: green;
text-align: center;
font-size: 15px;
width: 100%;
height: 35px;
background-color: #add8e6;
}
form {
width: 100%;
}
p.subheader {
text-align: center;
font-size: 20px;
}
button {
display: inline-block;
margin: 0 auto;
height: 43px;
padding: 0;
width: 128px;
}
#col1 {
padding: 10px;
width: 100% margin: auto;
height: 20px;
background-color: #e3f6fc;
}
#col2 {
margin-right: 10px;
margin-left: 10px;
width: 240px;
float: left;
}
#col3 {
margin-right: 10px;
margin-left: 10px;
witdh: 200px;
float: left;
}
#hakubutton {
background-image: url(hakunappi.png);
display: block;
}
#footer {
width: 100%;
height: 10px;
padding-top: 5px;
}
<body>
<div id="header">
<h1>Lorem ipsum dolor sit amet</h1>
</div>
<div id="content">
<div id="col1">
<form method="post" action="">
<label for="name">Lorem ipsum</label>
<input type="text" value="" />
<br/>
</div>
<p class="subheader">Lorem ipsum dolor sit amet</p>
<div id="col2">
<form action="index.php">
Lorem ipsum
<select name="type">
<option value="skycraper" selected>Lorem ipsum</option>
<option value="own">Lorem ipsum</option>
<option value="2floor">Lorem ipsum</option>
<option value="hotel">Lorem ipsum</option>
</select>
<br/>
<br/>Lorem ipsum
<select name="mode">
<option value="solar">Lorem ipsum</option>
<option value="wood">Lorem ipsum</option>
<option value="longdistance" selected>Lorem ipsum</option>
<option value="noheat">Lorem ipsum</option>
</select>
<br/>
<br/>Lorem ipsum
<select name="rooms">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<br/>
<br/>Lorem ipsum
<select name="size">
<option value="30" selected>30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="60">60</option>
</select>
</form>
</div>
<div id="col3">
<form action="index.php">
<label for="name">Lorem ipsum</label>
<input type="text" value="" />
<br/>
<br/>
<label for="name">Lorem ipsum</label>
<input type="text" value="" />
<br/>
<br/>Lorem ipsum
<select name="condition">
<option value="bad" selected>Lorem ipsum</option>
<option value="ok">Lorem ipsum</option>
<option value="good">Hyvä</option>
</select>
<br/>
<br/>m2
<input type="radio" name="ownership" value="rent">Lorem ipsum
<input type="radio" name="ownership" value="own">Lorem ipsum
<br>
</form>
<br/>
</form>
</div>
<button id="hakubutton">
</button>
<div id="footer">
</div>
</div>
</body>
</html>
简而言之:
这是我的网站: https://gyazo.com/b40f0e2298e6e42a03ae71b09c7ee805 这就是我想要实现的目标: https://gyazo.com/c35099cd12d512686e0b559cf6bc5620
答案 0 :(得分:0)
您应该在css中为背景图片的网址中添加引号
身体{
background-image:url(taustakuva.png);
background-repeat:no-repeat;
背景位置:左下角;
宽度:560px;
}
那么对于第二个问题,请注意下面的代码首先出现在你的css页面
*{
margin: 0;
padding: 0;
width: 100%;
}
我相信这会回答你的问题。