有人可以告诉我如何在我的网站上制作一个报价,无论是居中还是响应,所以它会随着浏览器窗口保持居中而变得更小,但也会因此在移动设备上更小。 / p>
谢谢
CSS
blockquote {
color: black;
position: relative;
display: inline-block;
padding: 0 5px;
margin: 0px auto;
left:27%;
}
blockquote p {
margin-bottom: 5px;
}
blockquote:before,
blockquote:after {
content: "“";
font-size: 70px;
font-family: "Georgia", Serif;
color: #28B701;
position: absolute;
left: -30px;
top: 5px;
}
cite {
float: right;
color: black;
font-size: 12px;
margin: 0;
padding: 0;
}
blockquote:after {
content: "”";
right: -30px;
left: auto;
}
HTML
<blockquote><p style="color:#666;">Socrates said, “Know thyself.” I say, “Know thy users.” They don’t think like you do.</p><cite>- Joshua Brewer</cite></blockquote></p>
答案 0 :(得分:1)
如果问题仍然存在,请参阅代码段并告诉我。
blockquote{
display: block;
max-width: 80%;
position: relative;
padding: 0 5px;
margin: 0 auto;
}
blockquote:before, blockquote:after {
content:"“";
font-size: 70px;
font-family:"Georgia", Serif;
color: #28B701;
position: absolute;
left: -30px;
top: 5px;
}
blockquote:after {
content:"”";
right: -30px;
left: auto;
}
cite {
float: right;
color: black;
font-size: 12px;
margin: 0;
padding: 0;
}
&#13;
<blockquote>
<p style="color:#666;">Socrates said, “Know thyself.” I say, “Know thy users.” They don’t think like you do.</p>
<cite>- Joshua Brewer</cite>
</blockquote>
&#13;
答案 1 :(得分:0)
由于blockquote
为inline-block
,您可以将text-align:center
置于父母的中心。
删除left
声明,因为它不是必需的。
body {
text-align: center;
}
blockquote {
color: black;
position: relative;
display: inline-block;
padding: 0 5px;
margin: 0px auto;
}
body {
text-align: center;
}
blockquote {
color: black;
position: relative;
display: inline-block;
padding: 0 5px;
margin: 0px auto;
}
blockquote p {
margin-bottom: 5px;
}
blockquote:before,
blockquote:after {
content: "“";
font-size: 70px;
font-family: "Georgia", Serif;
color: #28B701;
position: absolute;
left: -30px;
top: 5px;
}
cite {
float: right;
color: black;
font-size: 12px;
margin: 0;
padding: 0;
}
blockquote:after {
content: "”";
right: -30px;
left: auto;
}
&#13;
<blockquote>
<p style="color:#666;">Socrates said, “Know thyself.” I say, “Know thy users.” They don’t think like you do.</p><cite>- Joshua Brewer</cite>
</blockquote>
&#13;
答案 2 :(得分:0)
简单。
blockquote{
width:50%;
}
答案 3 :(得分:0)
blockquote {
width: 100%;
}
blockquote p {
margin-bottom: 5px;
}
blockquote:before,
blockquote:after {
content: "“";
font-size: 70px;
font-family: "Georgia", Serif;
color: #28B701;
position: absolute;
left: -30px;
top: 5px;
}
cite {
float: right;
color: black;
font-size: 12px;
margin: 0;
padding: 0;
}
blockquote:after {
content: "”";
right: -30px;
left: auto;
}
@media only screen and (min-width:768px) {
blockquote {
width: 500px;
margin: 0 auto;
}
}