gpt4 book ai didi

html - .float right 类不会向右浮动

转载 作者:行者123 更新时间:2023-11-28 16:27:58 25 4
gpt4 key购买 nike

你好,我无法让我的 windingroad.gif float 到我的页面右侧,但我不知道我做错了什么。我已经尝试了一切,但我一定遗漏了一些东西。非常感谢您的帮助。

body { background-color: #ffffcc;
background-image: url(background.gif);
color: #330000;
font-family: Verdana, Arial, sans-serif;
}
#wrapper { width: 80%;
margin-right: auto;
margin-left: auto;
background-color: #ffffcc;
min-width: 700px;
max-width: 1024px;
box-shadow: 3px 3px 3px #333333;
}
header { background-color: #ccaa66;
background-image:url("javalogo.gif");
background-position:center;
background-repeat:no-repeat;
color: #000000;
height:100px;
}
h1 {margin:0;
text-indent:100%;
white-space:nowrap;
overflow:hidden;
}
h2 { text-transform:uppercase;
background-color:#ffffcc;
color:#663300;
font-size:1.2em;
border-bottom:1px solid #000000;
padding:5px 0 0 5px;
margin-right:20px;
clear: left;
}
nav { text-align: center;
float:left;
width:100px;
font-weight:bold;
padding-top:10px;

/* unvisited link */
nav a:link {
color: #996633;
{
/* visited link */
nav a:visited {
color: #ccaa66;
}

/* mouse over link */
nav a:hover {
color: #330000;
}

nav ul {list-style-type:none;
}



}
footer { background-color: #ccaa66;
color: #000000;
font-size: .60em;
font-style: italic;
text-align: center;
padding-top:20px;
padding-bottom:20px;
clear:both;


}
main { padding-top: 10px;
padding-bottom:30px;
padding-left:20px;
padding-right:20px;
margin-left:150px;
background-color:#f2eab7;
color:#000000;
overflow:auto;

}
.details { padding-left: 20%;
padding-right: 20%;
overflow:auto;
}
img { border-style: none; }

nav a {text-decoration:none;
padding-bottom:15px;
}

.floatright {float: right;
padding-left:20px;
}

.floatleft{float: left;
padding-right:20px;
padding-bottom:bottom;
}

header,nav,main,footer{display:block;}
<!DOCTYPE html>
<html lang="en">
<head>
<title>JavaJam Coffee House</title>
<meta charset="utf-8">
<link rel="stylesheet" href="javajam.css">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js">
</script>
<![endif]-->
</head>
<body>
<div id="wrapper">
<header>
<h1>JavaJam Coffee House</h1>
</header>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="menu.html">Menu</a></li>
<li><a href="music.html">Music</a></li>
<li><a href="jobs.html">Jobs</a></li>
</ul>
</nav>
<main>
<p>Follow the winding road to JavaJam...</p>
<img src="windingroad.jpg" class="floatright" alt="winding road through the woods"
height="156" width="333">
<ul>
<li>Specialty Coffee and Tea</li>
<li>Bagels, Muffins, and Organic Snacks</li>
<li>Music and Poetry Readings</li>
<li>Open Mic Night</li>
</ul>
<div>
12312 Main Street<br>
Mountain Home, CA 93923<br>
1-888-555-5555<br>
<br>
</div>
</main>
<footer>
Copyright &copy; 2014 JavaJam Coffee House<br>
<a href="mailto:yourfirstname@yourlastname.com">yourfirstname@yourlastname.com</a>
</footer>
</div>
</body>
</html>

最佳答案

问题出在 CSS 中:1. 您没有在 nav{} block 中用“}”关闭导航。2. 将左括号放在导航 a:link block 的末尾,而不是“}”。

nav  { text-align: center; 
float:left;
width:100px;
font-weight:bold;
padding-top:10px;

/* unvisited link */
nav a:link {
color: #996633;
{

上面的代码应该这样写:

nav  { text-align: center; 
float:left;
width:100px;
font-weight:bold;
padding-top:10px;
}
/* unvisited link */
nav a:link {
color: #996633;
}

关于html - .float right 类不会向右浮动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35743504/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com