通过CSS将元素定位在边框上 <div class="myborder"> <span class="title">dingwei</span> </div> span.title { display: block; position: relative; text-align: center; background: white; top: -10px; left: 30px; width: 150px; } .myborder{ border: 1px solid black; } 结果