在我的html页面中,我有一张左侧浮动的图像。所有文本都应该出现在图像的右侧和底部,这是按预期工作的。
我遇到的唯一问题是使用blockquotes。预期结果:在图像的右侧 - >开始引号 - 引用 - 结束引号。 实际结果:缺少开始引号。
请注意,如果我将所有包含blockquote的文本放在div元素中并浮动它,则此问题将消失。但我不想浮动这个元素。
如果有人可以推荐此代码并建议任何解决方案,那将非常有用:Anshul's html
.contain img {
width: 100%;
height: 100%;
padding-right: 25px;*/
}
.main-div{
float:left;
width: 40%
}
.thin-black-border {
border-color: #686464;
border-width: 05px;
border-style: solid;
}
.header{
font: 200 80px'Oleo Script', Helvetica, sans-serif;
color: #F4E6E6;
text-shadow: 4px 4px 0px rgba(0,0,0,0.1);
}
/* =Structure
-------------------------------------------------------------- */
p {
margin-bottom: 30px;
}
p:last-child {
margin-bottom: 0;
}
/* =Blockquote
-------------------------------------------------------------- */
blockquote {
position: relative;
marign: 0px;
padding: 30px 30px;
text-align: center;
font-size: 30px;
/*display:inline-block;*/
}
blockquote:before, blockquote:after {
position: absolute;
width: 60px;
height: 60px;
font-size: 120px;
line-height: 1;
}
blockquote:before {
top: 0;
left: 0;
content: "\201C";
}
blockquote:after {
top: 0;
right: 0;
content: "\201D";
}
<body>
<div style="width:100%; height: 100px;background-color:#3B3838" >
<h1 class="text-center header">Madhubala</h1>
</div>
<div class = "main-div contain"> <img src="https://nehamalude.files.wordpress.com/2011/02/madhubala.jpg"/> </div>
<!-- If I don't comment the code below, start quotation mark shows up -->
<!--<div style="float:left; width: 60%; "> -->
<p><blockquote><span title = "Theatre Arts - American magazine"> The Biggest Star in the World - and she's not in Beverly Hills!</span></blockquote></p>
<p>Text.....</p>
<!--</div> -->
</body>
答案 0 :(得分:0)
使用float时使用blockquote的问题
只需删除位置:绝对;在blockquote中:之前,blockquote:课后
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style type="text/css">
.contain img {
width: 100%;
height: 100%;
padding-right: 25px;*/
}
.main-div{
float:left;
width: 40%
}
.thin-black-border {
border-color: #686464;
border-width: 05px;
border-style: solid;
}
.header{
font: 200 80px'Oleo Script', Helvetica, sans-serif;
color: #F4E6E6;
text-shadow: 4px 4px 0px rgba(0,0,0,0.1);
}
/* =Structure
-------------------------------------------------------------- */
p {
margin-bottom: 30px;
}
p:last-child {
margin-bottom: 0;
}
/* =Blockquote
-------------------------------------------------------------- */
blockquote {
position: relative;
marign: 0px;
padding: 30px 30px;
text-align: center;
font-size: 30px;
/*display:inline-block;*/
}
blockquote:before, blockquote:after {
width: 60px;
height: 60px;
font-size: 120px;
line-height: 1;
}
blockquote:before {
top: 0;
left: 0;
content: "\201C";
}
blockquote:after {
top: 0;
right: 0;
content: "\201D";
}
</style>
</head>
<body>
<div style="width:100%; height: 100px;background-color:#3B3838" >
<h1 class="text-center header">Madhubala</h1>
</div>
<div class = "main-div contain">
<img src="https://nehamalude.files.wordpress.com/2011/02/madhubala.jpg"/>
</div>
<!-- If I don't comment the code below, start quotation mark shows up -->
<!--<div style="float:left; width: 60%; "> -->
<p>
<blockquote><span title = "Theatre Arts - American magazine"> The Biggest Star in the World - and she's not in Beverly Hills!</span></blockquote>
</p>
<p> Text.....</p>
</body>
</html>
答案 1 :(得分:0)
引号未显示的原因是因为您的blockquote占据了容器宽度的100%。这意味着它从floatet图像下方开始。文本本身会调整以适合浮动图像,但引号设置为绝对定位:
position: absolute;
left: 0;
因此从容器的最左侧开始,位于图像下方。 如果删除绝对定位,问号将出现在文本的开头。