Hello,
I would like to do a table in markdown with a width of 100% of the page.
How to achieve this ?
Regards.
Hello,
I would like to do a table in markdown with a width of 100% of the page.
How to achieve this ?
Regards.
If you talk about markdown in Hugo:
The docs are not that bad: Requesting Help and this forum has a search function ![]()
in your hugo.toml
[markup]
[markup.goldmark]
[markup.goldmark.parser]
[markup.goldmark.parser.attribute]
block = true
Your Markdown content file table-example.md
| Syntax | Description |
| ----------- | ----------- |
| Header | Title |
| Paragraph | Text |
{ width="100%" }
for more use cases you can
inline htmlIt seems that it does not work …
Perhaps it’s due to the usage of this theme : Hextra.
maybe. Please read the given link. and follow.
show us what you have
Try this:
<table> you created.display:block; uncheck itAfter uncheck display:block; the table is displayed with width 100%.
Your theme allows overriding styles, so try this first.
In your root folder, create the file:
/assets/css/custom.css
And add:
@media (min-width: 1024px) {
table {
display: table;
}
}
This query will keep tables responsive on small screens and makes them full width on larger screens (prevent layout breaks).
Let us know if that works.
Sorry it does not work …
No worries, check the table again in Dev tools:
custom.css file is actually being loaded and you can see the @media query you added?display: table; rule struck through?If both are true, then is a specificty issue and the quick and dirty solution is to target the exact same selector that overrides it.
For example, if the rule that sets display: block; is:
.prose table {
/* Other rules*/
display: block;
}
Then update your custom.css to match the selector:
@media (min-width: 1024px) {
.prose table {
display: table;
}
}
Tell us which selector you find in Dev tools if you need help writing the exact override or share your website.
It is working with this piece of code:
.content :where(table):not(:where(.hextra-code-block table,[class~=not-prose],[class~=not-prose] *)) {
display: table;
}
If you must use display: table on a table element to behave like a table, something in the theme is weird.