I want give border via inbuild CSS in XML for a blog. See the sample: iPhone 12 mini. I have add the following code:
.table{
border: 1px solid black;
}
But, it does not give a border. Any ideas?
I want give border via inbuild CSS in XML for a blog. See the sample: iPhone 12 mini. I have add the following code:
.table{
border: 1px solid black;
}
But, it does not give a border. Any ideas?
Check if you have assigned the right class to the element you want to style. On the sample page there are no elements with the .table
class.
If you can only access CSS and you want to style elements on the page over which you don't have direct control, you can try to select elements by their name, their classes, IDs and other attributes using CSS selectors. You can use both single selectors and combination of them to obtain the specificity you need. There is also !important
CSS property which you can better not use to avoid maintenance difficulties of the code.
In your sample there are 2 things that can cause your problem:
border: 0;
and
.table
- this means that your table has a class="table"
, and from what I saw in the sample, that is not the case.My sugestion is either to add the class="table"
to your table and try again your css...
Something like so:
.table{
border: 1px solid black;
}
<body>
<table class="table" border="1">
...
</table>
</body>
Or remove the dot (and the need to include a class) - and use in your css simply :
table {
border: 1px solid black;
}
Mind you that this code, as per your sample css, only put a border around the table and not on all inner elements of said table.
Adding a border to the table doesn't have anything to do with CSS. You need to add an HTML Attribute Instead.
<HTML>
...
<body>
<table border="1">
...
</table>
</body>
...
<HTML>
CSS Borders are for decorations, bordering an image etc...
While <table>
doesn't use CSS Tables to make it visible, It can be added for decoration later, But it still requires the Border
HTML Attribute.