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:
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.
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"
can use
border-width:2px;
border-style:solid;
border-color:black;
or as shorthand
border: 2px solid black
Try being explicit about all the border properties. For example:
border:1px solid black;
See Border shorthand property. Although the other bits are optional some browsers don't set the width or colour to a default you'd expect. In your case I'd bet that it's the width that's zero unless specified.
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>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<style>
.border-5 {
border-width: 5px !important;
}
</style>
<textarea class="border border-dark border-5">some content</textarea>