1
0
Fork 0
firefox/testing/web-platform/tests/css/css-inline/text-box-trim/text-box-trim-initial-letter-start-001-ref.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

29 lines
974 B
HTML

<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
.spacer {
height: 50px;
background: lightgray;
}
.target {
font: 40px/1 Ahem;
position: relative;
}
.target::first-letter {
initial-letter: 2 1;
}
</style>
<div class="spacer"></div>
<div class="target">ApÉx</div>
<script>
// The font size of raised initial letters is undefined[1].
// Implementations, especially when using Ahem as a web font, don't match.
// To test the `text-box-trim` behavior by ignoring such differences, compute
// the expected position of the `target` dynamically.
// [1] https://drafts.csswg.org/css-inline-3/#sizing-initial-letter
const spacer = document.getElementsByClassName('spacer')[0];
const target = document.getElementsByClassName('target')[0];
const spacer_bottom = spacer.getBoundingClientRect().bottom;
const target_bottom = target.getBoundingClientRect().bottom;
target.style.top = `${spacer_bottom - target_bottom + 40}px`;
</script>