what's the best way to add a line break before and after div?

后端 未结 4 1827
天涯浪人
天涯浪人 2021-01-21 11:43

Someone shows me a html to use div tag to show some text with background image included

SOME TITLE
相关标签:
4条回答
  • 2021-01-21 12:09

    There are 2 main ways to add line breaks: through line break <br> tags and through paragraph tags <p>. So all you have to do is to put those tags in between your tags.

    0 讨论(0)
  • 2021-01-21 12:14

    Add the child divs to span like below

    <div class="class1" >
       <span class="span1">
             data1 
           <br>
           <span class="span2">
                data2
           </span>
        </span>
    </div>
    

    css:

       .span1{
          display:inline-block;
        }
        .span2{
          display:inline-block;     
        }
    
    
    
    
        </div>
    
    0 讨论(0)
  • 2021-01-21 12:27

    You can give margin from top and bottom like this:

    margin: 10px 0;
    

    Above will apply 10px margin from top and bottom. You can also use individual properties such as margin-top and margin-bottom.

    0 讨论(0)
  • 2021-01-21 12:27

    one way is to use css to style your elements.

    <style>
    .main
    {
      margin-bottom: 10px;
    }
    </style>
    

    you can alter as needed..not sure what div's you want to seperate

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