Comments (10)
Try adding "table-layout:fixed" on the table, it worked for me, at least for units in percentage, and a CSS table..
from weasyprint.
Thanks. table-layout: fixed
fixes the 40%
:60%
and 10em
tables.
Strangely it makes the 10em
:15em
table no longer be in that ratio, but I think that is allowed by the spec. Since the table width is greater than 25em
the surplus space has to be distributed between the columns, and the spec is silent on whether that should be equally or in proportion to their existing widths (or something else).
I'm leaving this bug report open though, because I think at least some of the behaviour without table-layout: fixed
is wrong. As a minimum, in the 40%
:60%
table the minimum width of the second column should be set to 60%
, yet it clearly isn't being.
from weasyprint.
Thanks for sharing your findings.
Percentages widths on table cells are ignored when the table has table-layout: auto
(the default.) This is a known bug, or missing feature depending on your point of view. I haven’t yet looked at the rest of the issue.
from weasyprint.
I think that's the only objective missing feature here.
There are other situations where WeasyPrint doesn't match browsers but the CSS spec doesn't insist on particular layout, so I think WeasyPrint's behaviour is allowed.
from weasyprint.
It should be fixed in 5b4b67e, feel free to test strange cases.
In the specification you can find that "If the table has 'width: auto', a percentage represents a constraint on the column's width, which a UA should try to satisfy." AFAIK, "should try to satisfy" means "do nothing" :).
Last missing feature: percentages are not handled on column groups.
from weasyprint.
AFAIK
Quelle mauvaise foi :)
from weasyprint.
And fd5cbad handles percentages for column groups.
If you tell a child: "you should try to make your bed", he obviously understands "do nothing". And AFAIK, children are like kittens: they are always right.
Should we try to close this bug?
from weasyprint.
As the original reporter, I'm closing this: re-running WeasyPrint 0.21 on the original demo file above now follows the 40%:60% constraints.
The 10em
case still doesn't match browsers, but I think it does follow specs. And from a practical point of view, the desired behaviour for that case can be achieved with table-layout: fixed
, so all layouts can now be achieved with WeasyPrint.
Thanks for fixing.
from weasyprint.
The 10em case still doesn't match browsers, but I think it does follow specs.
Which spec is that? Note that the automatic table layout algorithm in CSS 2 is non-normative and does not match what browsers do.
http://dbaron.org/css/intrinsic/ is closer, although not a spec and slightly out of date according to the author.
from weasyprint.
Sorry, that was sloppy phrasing on my part. By “follow specs”, I meant “behave in a way which is compatible with what specs actually require”.
That includes that non-normative CSS2 algorithm, which effectively treats width:
on a table cell as being min-width:
.
from weasyprint.
Related Issues (20)
- Migrate to resvg? HOT 2
- Support grid-auto-flow: column HOT 4
- Fonts breaking in v62 HOT 8
- Grid support enhancements
- v62 - TypeError: can't multiply sequence by non-int of type 'float' HOT 1
- Create single page pdf for thermal printer HOT 1
- Bold font sometimes work but sometimes doesn't HOT 2
- Grid support with errors (print-css-rocks) HOT 3
- PDF/UA accessibility. Labeled strange.
- TypeError: can only concatenate str (not "float") to str (after update from 61.2 to 62.1) HOT 5
- Tailwind color codes are incompatible HOT 2
- Issue when trying to write a pdf with the openssl_md5 function in your library HOT 1
- Failure when building wheel for 62.1 from pypi HOT 5
- Add support for ol start attribute HOT 2
- Weasyprint (62.1) broken on macOS using Python 3.12.3 from python.org HOT 3
- python api: set created date HOT 3
- Support overflow-x/y HOT 1
- display flex is breaking UI HOT 1
- tailwindcss as stylesheets: TypeError: 'NoneType' object is not subscriptable HOT 3
- Background image flickers HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weasyprint.