亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何將元素拆分為兩個連續的部分并在它們之間添加另一個元素

如何將元素拆分為兩個連續的部分并在它們之間添加另一個元素

料青山看我應如是 2021-05-14 14:12:03
可以將html元素按特定高度拆分為兩個連續的部分,并使用javascript自動在它們之間添加另一個元素,例如將圖像拆分為兩個部分并在它們之間添加其他圖像。例子 :p {  width: 300px;}.original-div {  border: 1px solid black;}.div1 {  border-bottom: none;}.div1 p {  margin-bottom: 0;}.div2 {  border-top: none;}.div2 p {  margin-top: 0;}.new-elem {  font-weight: bold;  border: 2px solid red;  background-color: blue;  color: white;}<strong>Original</strong><hr/><div class="original-div">  <p>    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has    survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing    software like Aldus PageMaker including versions of Lorem Ipsum.  </p></div><br/><strong>Output</strong><hr/><div class="original-div div1">  <p>    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen  </p></div><div class="new-elem">  INSERTED ELEMENT</div><div class="original-div div2">  <p>    book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with    desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.  </p></div>
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 132 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號