Vertical line between divs

1

Is it possible to make a vertical line between DIVs? wanted to create a tab for the data. Here is an example of the code I'm using:

<div style="float:left; max-width:200px;max-height:200px;" class="text-center">
     <b>Telefone</b><br />
     @Html.DisplayFor(modelItem => item.Telefone)
</div>
<div style="float:left; max-width:200px;max-height:200px;margin-left:10px;" class="text-center">
     <b>Celular</b><br />
     @Html.DisplayFor(modelItem => item.Celular)
</div>

I want a vergical line between them already tried for in the property of the div in Style the border-left, but neither rolled ...

    
asked by anonymous 12.11.2016 / 00:43

2 answers

3

This can also be used if you want to put it as a separate element:

<hr width="1" size="100">

You can change the size to the desired size.

It also works:

<hr style=" transform: rotate(90deg); width: 100px; ">

You can of course just put the tag <hr> which is a horizontal line and turn 90º into CSS:

hr {
  transform: rotate(90deg);
  width: 100px;
}
<hr>

You can again change the width to the desired size as well.

    
12.11.2016 / 03:57
3

It seems that your question is more about CSS (Style) than the languages defined in tags . See, for a vertical line between divs you just have to, as you mentioned, a border-left in the rightmost element that would already solve the problem.

Your code looks like this:

<div style="float:left; max-width:200px;max-height:200px;" class="text-center">
     <b>Telefone</b><br />
     @Html.DisplayFor(modelItem => item.Telefone)
</div>
<div style="float:left; max-width:200px;max-height:200px;margin-left:10px; border-left:1px solid #666" class="text-center">
     <b>Celular</b><br />
     @Html.DisplayFor(modelItem => item.Celular)
</div>

Note that the following style was added inside the style property of the second div : border-left:1px solid #666 .

Another approach would be to use the Flexbox . See how you would look at codepen .

abs.

    
12.11.2016 / 01:53