css - 屏幕/内容更改时防止 div 水平扩展

标签 css html

我的主要内容有问题。随着屏幕大小的调整或主要内容的文本变大,它会按预期向下扩展,但它也会出现在我的左侧菜单下,这是我不想要的。

有人可以检查我的代码并告诉我如何解决这个问题吗?

图片: Image of what I want vs what is occurring

<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;

参见 http://jsfiddle.net/bULaF/

关于css - 屏幕/内容更改时防止 div 水平扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24477417/

相关文章:

javascript - Cordova 键盘更改布局

html - Ionic 4 选项卡在父元素上切割

javascript - Firefox 将注释文本保存在 style 元素内的 textContent 中

javascript - JW Player 6 寻找和暂停

android - 使用 CSS 媒体查询独立于 Android 设备定位 iPhone

javascript - 无法在 'removeChild' : parameter 1 is not of type 'Node' 上执行 'Node'

html - 变换 drop down to drop UP

javascript - 在模态 html 中格式化数据

jquery - 使用jquery在排序中隐藏所有内容

html - 如何在整个页面上创建一个深色半透明封面?