Using The Table Head Colspan Attribute Using Styled-components
Trang chủ » Html Table Th Column Span
» Using The Table Head
Colspan Attribute Using Styled-components
Có thể bạn quan tâm
The colspan attribute works fine on a table built with HTML & CSS.
th, td { border: 1px solid black } <table> <thead> <tr> <th colspan="2">Major 1</th> <th colspan="2">Major 2</th> </tr> <tr> <th>col1</th> <th>col2</th> <th>col3</th> <th>col4</th> </tr> </thead> <tbody> <tr> <td>data1</td> <td>data2</td> <td>data3</td> <td>data4</td> </tr> </tbody> </table>
I am trying to implement this very same thing using styled-components.
const styled = window.styled; const LS = {}; LS.TableHead_TH = styled.th` /* THINGS I'VE TRIED IN HERE */ colspan: 2; col-span: 2; column-span: 2; /* <--- THIS IS SUGGESTED BY AUTOCOMPLETE */ `; function Table() { return( <table> <thead> <tr> <LS.TableHead_TH>Major 1</LS.TableHead_TH> <LS.TableHead_TH>Major 2</LS.TableHead_TH> </tr> <tr> <th>col1</th> <th>col2</th> <th>col3</th> <th>col4</th> </tr> </thead> <tbody> <tr> <td>data1</td> <td>data2</td> <td>data3</td> <td>data4</td> </tr> </tbody> </table> ); } ReactDOM.render(<Table/>, document.getElementById("root")); th, td { border: 1px solid black } <script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.3/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.3/umd/react-dom.production.min.js"></script> <script src="//unpkg.com/[email protected]/dist/styled-components.min.js"></script> <div id="root"/>
But as you can see from the snippet, it does not work. And I've tried several properties.
If I send it as a regular attribute on my JSX, it still works. Like:
<LS.TableHead_TH colspan="2">Major 1</LS.TableHead_TH> <LS.TableHead_TH colspan="2">Major 2</LS.TableHead_TH> UPDATE: Actually the code above worked here on SO. But on my local environment, I had to pass it camelCased, like colSpan
<LS.TableHead_TH colSpan="2">Major 1</LS.TableHead_TH> <LS.TableHead_TH colSpan="2">Major 2</LS.TableHead_TH> What am i doing wrong?
PS: Tested only in Chrome, so far.
Từ khóa » Html Table Th Column Span
-
HTML Th Colspan Attribute - W3Schools
-
HTML Table Colspan & Rowspan - W3Schools
-
HTML | Colspan Attribute - GeeksforGeeks
-
Table Rowspan And Colspan In HTML Explained (With Examples) »
-
HTML Colspan Attribute - Tutorialspoint
-
HTML Th Colspan Attribute - Dofactory
-
How To Implement HTML Colspan With Examples? - EduCBA
-
Tables With Irregular Headers | Web Accessibility Initiative (WAI) | W3C
-
Tables In HTML Documents
-
HTML Colspan Attribute - HTML Tutorials - W3resource
-
CSS Colspan: How To Create Multiple Columns In Your HTML Tables
-
HTML Table Colspan And Rowspan - Mockstacks Free Tutorials For ...
-
Column-span - CSS: Cascading Style Sheets - MDN Web Docs
-
(Archives) HTML: Tables: Column Span - UW-Eau Claire
Liên Hệ
TRUYỀN HÌNH CÁP SÔNG THU ĐÀ NẴNG
Địa Chỉ: 58 Hàm Nghi - Đà Nẵng
Phone: 0904961917
Facebook: https://fb.com/truyenhinhcapsongthu/
Twitter: @ Capsongthu
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu
Trang chủ » Html Table Th Column Span » Using The Table Head
Có thể bạn quan tâm
The colspan attribute works fine on a table built with HTML & CSS.
th, td { border: 1px solid black } <table> <thead> <tr> <th colspan="2">Major 1</th> <th colspan="2">Major 2</th> </tr> <tr> <th>col1</th> <th>col2</th> <th>col3</th> <th>col4</th> </tr> </thead> <tbody> <tr> <td>data1</td> <td>data2</td> <td>data3</td> <td>data4</td> </tr> </tbody> </table>
I am trying to implement this very same thing using styled-components.
const styled = window.styled; const LS = {}; LS.TableHead_TH = styled.th` /* THINGS I'VE TRIED IN HERE */ colspan: 2; col-span: 2; column-span: 2; /* <--- THIS IS SUGGESTED BY AUTOCOMPLETE */ `; function Table() { return( <table> <thead> <tr> <LS.TableHead_TH>Major 1</LS.TableHead_TH> <LS.TableHead_TH>Major 2</LS.TableHead_TH> </tr> <tr> <th>col1</th> <th>col2</th> <th>col3</th> <th>col4</th> </tr> </thead> <tbody> <tr> <td>data1</td> <td>data2</td> <td>data3</td> <td>data4</td> </tr> </tbody> </table> ); } ReactDOM.render(<Table/>, document.getElementById("root")); th, td { border: 1px solid black } <script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.3/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.3/umd/react-dom.production.min.js"></script> <script src="//unpkg.com/[email protected]/dist/styled-components.min.js"></script> <div id="root"/>
But as you can see from the snippet, it does not work. And I've tried several properties.
If I send it as a regular attribute on my JSX, it still works. Like:
<LS.TableHead_TH colspan="2">Major 1</LS.TableHead_TH> <LS.TableHead_TH colspan="2">Major 2</LS.TableHead_TH>UPDATE: Actually the code above worked here on SO. But on my local environment, I had to pass it camelCased, like colSpan
<LS.TableHead_TH colSpan="2">Major 1</LS.TableHead_TH> <LS.TableHead_TH colSpan="2">Major 2</LS.TableHead_TH>What am i doing wrong?
PS: Tested only in Chrome, so far.
Từ khóa » Html Table Th Column Span
-
HTML Th Colspan Attribute - W3Schools
-
HTML Table Colspan & Rowspan - W3Schools
-
HTML |
Colspan Attribute - GeeksforGeeks Table Rowspan And Colspan In HTML Explained (With Examples) »
HTML
Colspan Attribute - Tutorialspoint HTML Th Colspan Attribute - Dofactory
How To Implement HTML Colspan With Examples? - EduCBA
Tables With Irregular Headers | Web Accessibility Initiative (WAI) | W3C
Tables In HTML Documents
HTML Colspan Attribute - HTML Tutorials - W3resource
CSS Colspan: How To Create Multiple Columns In Your HTML Tables
HTML Table Colspan And Rowspan - Mockstacks Free Tutorials For ...
Column-span - CSS: Cascading Style Sheets - MDN Web Docs
(Archives) HTML: Tables: Column Span - UW-Eau Claire
Liên Hệ
TRUYỀN HÌNH CÁP SÔNG THU ĐÀ NẴNG
Địa Chỉ: 58 Hàm Nghi - Đà Nẵng
Phone: 0904961917
Facebook: https://fb.com/truyenhinhcapsongthu/
Twitter: @ Capsongthu
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu