html - 不在 html 中显示 block 引用和背景

标签 html css blockquote

我正在尝试创建一个如下所示的 HTML 片段:

enter image description here

我写了一些代码,但背景、斜体和左侧引号显示不正确。这是我尝试过的:

mission blockquote.style1 {
    font: 14px/20px italic;
    padding: 8px;
    background-color: #000000;
    border-top: 1px solid #e1cc89;
    border-bottom: 1px solid #e1cc89;
    margin: 5px;
    background-image: url(../images/openquote1.gif);
    background-position: top left;
    background-repeat: no-repeat;
    text-indent: 23px;
}

.mission blockquote.style1 span {
    display: block;
    background-image: url(images/openquote1.gif);
    background-repeat: no-repeat;
    background-position: bottom right;
}
<div class=""mission>
    <h2>Mission</h2>
    <hr>
    <blockquote>
        <p class="style1">
            <span>Our mission is to grow with our customers by providing quality products,timely delievery & personalised services</span>
        </p>
    </blockquote>
</div>
	

最佳答案

CSS 有规则和标准,如果你不遵守它们,你就不能指望“魔法”会发生。

你没有:

  1. 遵循正确的选择器规则(mission blockquote.style1.mission blockquote .style1 不同)
  2. 遵循正确的font属性规则(必须有字体系列,必须以正确的顺序排列)
  3. 使用正确的 html 结构(class=""mission 完全错误)

最重要的是:

  1. 如果您需要引号,则需要将它们放在 HTML 中
  2. 如果你设置了全黑背景,你将看不到任何东西

长话短说:花点时间编写正确的代码。

.mission blockquote .style1 {
  font: italic 14px/20px serif;
  padding: 8px;
/*      background-color: #000000;*/
  border-top: 1px solid #e1cc89;
  border-bottom: 1px solid #e1cc89;
  margin: 5px;
/*      background-image: url(../images/openquote1.gif);*/
  background-position: top left;
  background-repeat: no-repeat;
  text-indent: 23px;
  }
.mission blockquote .style1 span {
    	display: block;
/*        	background-image: url(images/openquote1.gif);*/
    	background-repeat: no-repeat;
    	background-position: bottom right;
  	}
<div class="mission">
<h2>Mission</h2>
<hr>
<blockquote><p class="style1"><span>Our mission is to grow with our customers by providing quality products,timely delievery & personalised services</span></p></blockquote>
</div>

关于html - 不在 html 中显示 block 引用和背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31376116/

相关文章:

html - CSS nth-child 表达式删除最后一行的底部边距

html - 将具有特定 ID 的 HTML 表单封装在新标签中

iphone - html 在我电脑上的所有浏览器上都能正常工作,但是我用作可点击链接的 href 在 iphone 上的 safari 上移动了

html - CSS - 焦点登录字段就像只有 CSS 的 twitter 一样?

javascript - Fancybox v2.1.1 改变边框颜色

html - Bootstrap 4.1.3 : sidebar doesn't show up when applying blockquote class

HTML 解析不佳

html - parent 的相对位置增长以适应 child 的绝对位置高度

html - CSS 在 Firefox 上加载但不呈现

c# - 如何使用javascript在Asp.Net Gridview中获取html标签?