我有以下html代码。



body {
  background: lime !important;
}


/* Adding !important forces the browser to overwrite the default style applied by Bootstrap */

.mid-section {
  padding: 0 10px;
  background: white;
  border-color: black;
  border-width: 5 px;
  border-style: solid;
}

.import-notes {
  background: yellow;
}

<body>
  <div class="container">
    <h1>Testing </h1>
    <div class="mid-section">
      <p>(1)This is a test </p>
      <p>(2)This is a test </p>
      <p>(3)This is a test </p>
      <p class="import-notes">This is full width no padding</p>
    </div>
  </div>
</body>





我想将<p class="import-notes">设置为全宽而不填充。

最佳答案

<p class="import-notes">


已经有全宽,但我认为您想要这样:



body { background: lime !important; } /* Adding !important forces the browser to overwrite the default style applied by Bootstrap */
.mid-section {
    padding:0 10px;
    background : white;
    border-color : black;
    border-width: 5 px;
    border-style: solid;
}
.import-notes {
    background : yellow;
    margin-left:-10px;
    margin-right:-10px;
}

<div class="container">
  <h1>Testing </h1>
  <div class="mid-section">
      <p>(1)This is a test </p>
      <p>(2)This is a test </p>
      <p>(3)This is a test </p>
      <p class="import-notes">This is full width no padding</p>
   </div>
</div>

关于html - 在带有div的div中使一个p标签全宽,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48555822/

10-12 00:14