How can I put a vertical line down the center of a div?

后端 未结 8 1849
陌清茗
陌清茗 2020-12-24 00:59

How do I put a vertical line down the middle of a div? Maybe I should put two divs inside the div and put a left border on one and a right border on the other? I have a DIV

相关标签:
8条回答
  • 2020-12-24 01:58

    Three divs?

    <div>
       <div>
          /* ascx 1 goes here */
       </div>
       <div style="width:1px; background-color: #000"></div>
       <div>
          /* ascx 2 goes here */
       </div>
    </div>
    
    0 讨论(0)
  • 2020-12-24 02:02

    Maybe this can help you

    .here:after {
        content:"";
        position: absolute;
        z-index: -1;
        top: 0;
        bottom: 0;
        left: 50%;
        border-left: 2px dotted #ff0000;
        transform: translate(-50%);
    }
    
    div {
        margin: 10px auto;
        width: 60%;
        height: 100px;
        border: 1px solid #333;
        position:relative;
        text-align:center
    }
    <div class="here">Content</div>

    Here's is a JSFiddle demo.

    0 讨论(0)
提交回复
热议问题