可以将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>
添加回答
举报
0/150
提交
取消