I am trying to define a border around a div tag in HTML. In some browsers the border does not appear.
Here is my HTML code:
<div id="divActivites" name="divActivites" style="border:thin">_x000D_
<textarea id="inActivities" name="inActivities" style="border:solid">_x000D_
</textarea> _x000D_
</div>
_x000D_
How do I set a border for an HTML div tag?
You can use:
border-style: solid;
border-width: thin;
border-color: #FFFFFF;
You can change these as you see fit, though.
You need to set more fields then just border-width. The style basically puts the border on the page. Width controls the thickness, and color tells it what color to make the border.
border-style: solid; border-width:thin; border-color: #FFFFFF;
In bootstrap 4, you can use border utilities like so.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />_x000D_
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>_x000D_
_x000D_
<style>_x000D_
.border-5 {_x000D_
border-width: 5px !important;_x000D_
}_x000D_
</style>_x000D_
_x000D_
<textarea class="border border-dark border-5">some content</textarea>
_x000D_
As per the W3C:
Since the initial value of the border styles is 'none', no borders will be visible unless the border style is set.
In other words, you need to set a border style (e.g. solid
) for the border to show up. border:thin
only sets the width. Also, the color will by default be the same as the text color (which normally doesn't look good).
I recommend setting all three styles:
style="border: thin solid black"
<style>
p{border: 1px solid red}
div{border: 5px solid blue}
Call me Ishmael.
Call me Ishmael.
Just don't call me late for dinner.
.centerImge {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
height:50%;
}
<div>
@foreach (var item in Model)
{
<span> <img src="@item.Thumbnail" class="centerImge" /></span>
<h3 style="text-align:center"> @item.CategoryName</h3>
}
</div>
can use
border-width:2px;
border-style:solid;
border-color:black;
or as shorthand
border: 2px solid black
I guess this is where you are pointing at ..
<div id="divActivites" name="divActivites" style="border:thin">
<textarea id="inActivities" name="inActivities" style="border:solid">
</textarea>
</div>
Well. it must be written as border-width:thin
Here you go with the link (click here) check out the different types of Border-styles
you can also set the border width by writing the width in terms of pixels.. (like border-width:1px), minimum width is 1px.
Source: Stackoverflow.com