我的主要内容有问题。随着屏幕大小的调整或主要内容的文本变大,它会按预期向下扩展,但它也会出现在我的左侧菜单下,这是我不想要的。
有人可以检查我的代码并告诉我如何解决这个问题吗?
图片:
<html>
<head>
<link type="text/css" rel="stylesheet" href="css/styles.css"/>
<link href='http://fonts.googleapis.com/css?family=Josefin+Slab:400,400italic' rel='stylesheet' type='text/css'>
<title>page title</title>
</head>
<body>
<div class="pagediv">
<div class="headermain">
Title
</div>
<div class="headerquote">
quote
</div>
<div class="menu">
<p><a href="link">Home</a></p>
<p><a href="link">About the Artist</a></p>
<p><a href="link>"Blog</a></p>
<p><a href="link">Artist Statement</a></p>
<p><a href="link">Inspiration</a></p>
<p><a href="link">Art Gallery</a></p>
<p><a href="link">Exhibits</a></p>
<p><a href="link">Store</a></p>
<p><a href="link">Commissioning</a></p>
<p><a href="link">Contact</a></p>
</div>
<div class="artist_pic">
<img src="picture link">
</div>
<div class="content_type_a">
<p>CONTENT HERE</p>
</div>
<div class="footer">
我的 CSS 如下:
body {
background-color: black;
}
/*contains the page in the center of the browser*/
.pagediv {
margin-left: auto;
margin-right: auto;
width: 70%;
background-color: black;
}
/*Main title bar at the top of the page*/
.headermain {
background-color: black;
font-family: 'Josefin Slab', serif;
color: #FFF;
font-size: 200%;
font-style: bold;
display: block;
width: 100%;
padding-top: 30px;
}
/*Quote after the main title*/
.headerquote {
background-color: black;
font-family: 'Josefin Slab', serif;
font-size: 110%;
font-style: italic;
color: #FFF;
padding-top: 5px;
padding-left: 60px;
padding-bottom: 5px;
display: block;
}
/*headerquote bottom border*/
.headerquote {
border-bottom: 2px solid white;
}
.menu {
background-color: black;
width: auto;
font-family: 'Josefin Slab', serif;
color: #FFF;
font-size: 110%;
font-style: bold;
text-align: right;
display: inline-block;
float: left;
clear: right;
clear: both;
padding-right: 15px;
height: px;
}
.menu a:link {
text-decoration: none;
color: #FFF;
font-size: 110%;
}
.menu a:hover {
color: #FFF;
font-size: 110%;
text-decoration:underline;
}
.menu a:visited {
text-decoration: none;
color: #FFF;
font-size: 110%;
}
.artist_pic {
display: inline-block;
width: auto;
clear: none;
position: relative;
float: left;
margin-left: 0px;
margin-top: 20px;
margin-right: 20px;
margin-bottom: 10px;
}
.content_type_a {
background-color: black;
font-family: Arial, serif;
font-size: 100%;
color: #FFF;
width: auto;
float: 40%;
clear: none;
display: block;
text-align:justify;
}
.construction {
background-color: black;
font-family: Arial, serif;
font-size: 100%;
color: #FFF;
display: block;
text-align:justify;
}
.construction img {
background-color: transparent;
height: 150px;
border: none;
width: auto;
font-family: Arial
color: #FFF;
font-size: 100%;
font-style: bold;
text-align: center;
padding: 20px 0px 0px 100px;
}
.footer {
}
最佳答案
你可以删除
text-align:justify;
从 .content_type_a
样式添加
position: absolute;
left: 220px;
关于css - 屏幕/内容更改时防止 div 水平扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24477417/