已经做了一些关于它为什么这样做的研究但是,我似乎无法解决这个问题。标题徽标/文本保持重叠。任何人都知道为什么会这样做?
http://jsfiddle.net/uljima/bcm96v49/
调整大小:
http://i.stack.imgur.com/l2P3z.png
尝试了许多事情,但它不断重叠徽标。
HTML:
<html>
<header>
<title>KeyStone Coffee</title>
<link rel="stylesheet" href="styles/styles.css">
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Anton' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
</style>
</head>
<div class="wrapper">
<body>
<body>
<header>
<div class= "Company_Logo">
<a href="http://imgur.com/Qu8f4K3"><img src="http://i.imgur.com/Qu8f4K3.png" title="source: imgur.com" alt="Company Logo" height="200" width="200"/></a>
</div>
<center>
<div class= "Company_Text">
<h1>Keystone Coffee</h1>
</div>
</center>
<div class="HPFGAC">
<nav>
<ul>
<center>
<li><a href = "index.html">HOME</a></li>
<li><a href = "Products/Products.html">PRODUCTS</a></li>
<li><a href = "#">FLAVORED COFFEE</a></li>
<li><a href = "#">GUIDE TO THE PERFECT TASTE</a></li>
<li><a href = "#">ABOUT</a></li>
<li><a href = "#">CONTACT</a></li>
</center>
</ul>
</nav>
</div>
</html>
</header>
CSS:
#wrapper {
height: 850px;
width: 960px;
margin:0 auto;
background-repeat: no-repeat;
background-position: center center;
}
.row:after{
clear: both;
}
.col{
background: black;
border-radius: 5px;
color: white;
padding: .5px;
float: left;
margin: 1%;
width: 100%;
}
.row:after{
clear: both;
}
.col{
background: black;
border-radius: 5px;
color: white;
padding: .5px;
float: left;
margin: 1%;
width: 100%;
}
.WebContainer{
width: 100%;
height: auto;
}
.articles{
width:90%;
height: auto;
margin: auto;
}
.DIV
{
margin-left:0px;
margin-right:0px;
}
.box2 {
display: inline-block;
width: 100%;
height: 100px;
margin: 1em;
}
html{
overflow: scroll;
height: 100%;
margin: auto;
width:100%;
}
body {
height: 960px;
margin: 0;
padding:0;
width:100%;
text-align:center;
}
header {
background: white;
color: Black;
padding: 0px 15px 15px 15px;
float: center-side;
margin-left: auto;
margin-right: auto;
}
header h1 {
margin: 0px;
display: inline;
float: center-side;
margin-left: auto;
margin-right: auto;
}
nav ul{
margin: 0px;
padding : 0 0 15px 0;
display: inline;
float: center-side;
margin-left: auto;
margin-right: auto;
}
nav ul li{
background: wwhite;
color: #9D795B;
display: inline-block;
list-style-type: none;
padding: 5% 15px 20px 15px;
margin: 0;
float: center-side;
margin-left: auto;
margin-right: auto;
font-size: 1.875em;
white-space:nowrap;
}
nav ul li a {
color: #9D795B;
float: center-side;
margin-left: auto;
margin-right: auto;
}
.Company_Logo{
float:center-left
clear: both;
position: absolute;
top: 0%;
right: 70.5%;
z-index: 9999;
display: block;
white-space:nowrap;
padding: 2px 2px 2px 2px;
}
.Company_Logo{
width:100px;
}
.Company_Text{
clear: both;
color:#9D795B;
font-size:50.5px;
font-family: 'Lobster', cursive;
display: inline;
white-space:nowrap;
}
.Company_Text{
clear: both;
position: relative;
top: 35px;
right: -2.75%;
z-index: 9999;
}
.HPFGAC{
clear: both;
font-family: 'Anton', sans-serif;
white-space:nowrap;
}
.HPFGAC a:link {
text-decoration: none;
}
.HPFGAC a:visited {
text-decoration: none;
}
.HPFGAC a:hover {
text-decoration: underline;
}
.HPFGAC a:active {
text-decoration: underline;
}
答案 0 :(得分:1)
很好的尝试,但我必须说你需要对你的代码进行一些真正的工作,这很糟糕。
HTML
<title>KeyStone Coffee</title>
<link rel="stylesheet" href="styles/styles.css">
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Anton' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
</style>
</head>
<div class="wrapper">
<body>
<body>
<header>
<div class="Company_Logo"> <a href="http://imgur.com/Qu8f4K3"><img src="http://i.imgur.com/Qu8f4K3.png" title="source: imgur.com" alt="Company Logo" height="200" width="200"/></a>
</div>
<center>
<div class="Company_Text">
<h1>Keystone Coffee</h1>
</div>
</center>
<div class="HPFGAC">
<nav>
<ul>
<center>
<li><a href="index.html">HOME</a>
</li>
<li><a href="Products/Products.html">PRODUCTS</a>
</li>
<li><a href="#">FLAVORED COFFEE</a>
</li>
<li><a href="#">GUIDE TO THE PERFECT TASTE</a>
</li>
<li><a href="#">ABOUT</a>
</li>
<li><a href="#">CONTACT</a>
</li>
</center>
</ul>
</nav>
</div>
CSS
#wrapper {
height: 850px;
width: 960px;
margin:0 auto;
background-repeat: no-repeat;
background-position: center center;
}
.row:after {
clear: both;
}
.col {
background: black;
border-radius: 5px;
color: white;
padding: .5px;
float: left;
margin: 1%;
width: 100%;
}
.row:after {
clear: both;
}
.col {
background: black;
border-radius: 5px;
color: white;
padding: .5px;
float: left;
margin: 1%;
width: 100%;
}
.WebContainer {
width: 100%;
height: auto;
}
.articles {
width:90%;
height: auto;
margin: auto;
}
.DIV {
margin-left:0px;
margin-right:0px;
}
.box2 {
display: inline-block;
width: 100%;
height: 100px;
margin: 1em;
}
html {
overflow: scroll;
height: 100%;
margin: auto;
width:100%;
}
body {
height: 960px;
margin: 0;
padding:0;
width:100%;
text-align:center;
}
header {
background: white;
color: Black;
padding: 0px 15px 15px 15px;
float: center-side;
margin-left: auto;
margin-right: auto;
}
header h1 {
margin: 0px;
display: inline;
float: center-side;
margin-left: auto;
margin-right: auto;
}
nav ul {
margin: 0px;
padding : 0 0 15px 0;
display: inline;
float: center-side;
margin-left: auto;
margin-right: auto;
}
nav ul li {
background: wwhite;
color: #9D795B;
display: inline-block;
list-style-type: none;
padding: 5% 15px 20px 15px;
margin: 0;
float: center-side;
margin-left: auto;
margin-right: auto;
font-size: 1.875em;
white-space:nowrap;
}
nav ul li a {
color: #9D795B;
float: center-side;
margin-left: auto;
margin-right: auto;
}
.Company_Logo {
float: left;
padding: 2px 2px 2px 2px;
}
header center{
overflow: hidden;
}
.Company_Text {
padding-top: 30px;
color:#9D795B;
text-align: left;
font-size:50.5px;
font-family:'Lobster', cursive;
white-space:nowrap;
}
.HPFGAC {
clear: both;
font-family:'Anton', sans-serif;
white-space:nowrap;
}
.HPFGAC a:link {
text-decoration: none;
}
.HPFGAC a:visited {
text-decoration: none;
}
.HPFGAC a:hover {
text-decoration: underline;
}
.HPFGAC a:active {
text-decoration: underline;
}
链接到Fiddle
我希望这会有所帮助,欢呼。
答案 1 :(得分:0)
.Company_Text {
clear: both;
color:#9D795B;
font-size:50.5px;
font-family:'Lobster', cursive;
display: inline;
position: relative;
white-space:nowrap;
}
.Company_Text {
clear: both;
position: relative;
top: 30px;
margin-left: 210px;
right: -2.75%;
z-index: 9999;
}
.HPFGAC {
clear: both;
font-family:'Anton', sans-serif;
white-space:nowrap;
margin-top: 60px;
}
试试这个。