我有一个文件,使用A,P和SPAN与类下降下降的下降资本。当我在一个段落中直接有文本时,它正常工作。但是,如果段落以锚或P类跨度开始,则会出现多余的空格。如果我用下面的文本邻接结束>,一些无关的空间消失了,但不是全部。如果可能的话,我希望保留标记的缩进,避免将每节经文的首字母放在单独的元素中。
A或SPAN中的class=drop是必需的,因为否则第一个字母将无法识别。
<!DOCTYPE HTML>
<html lang=en>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<TITLE>favorite things</TITLE>
<META name="KEYWORDS" CONTENT="filk">
<style>
p {
left:20%;
position:relative;
right:-20%;
margin-left:2em;
width:60%;
}
p.drop {
margin-left:2em;
}
p.drop::first-letter
{
font-size:2em;
margin-left:-2em;
}
a.drop::first-letter,
span.drop::first-letter
{
font-size:2em;
}
a.L,div.L,span.L,a.R,div.R,span.R {
display:inline;
--width:14%;
width:var(--width);
position:absolute;
container-type: inline-size;
}
a.L,div.L,span.L {
left:-20%;
}
a.R,div.R,span.R {
right:0;
}
h1 {
text-align:center;
font-size:4em;
}
img.V {
display:block;
height:auto;
width:100%;
margin-top: 10%;
}
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
width: 20em;
background-color: #555;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text */
position: absolute;
z-index: 1;
bottom: 102%;
left: calc(-10em + 50%);
/* Fade in tooltip */
opacity: 0;
transition: opacity 0.3s;
}
.L .tooltiptext {
left: 0;
text-align: left;
}
.R .tooltiptext {
left: auto;
right: 0%;
text-align: left;
}
/* Tooltip arrow */
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
width: 1px;
}
.L .tooltiptext::after {
left: 20cqw;
}
.R .tooltiptext::after {
left: auto;
right: 20cqw;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
.verse {
font-size: 2em;
text-align: center;
width:60%
}
</style>
</head>
<BODY LANG="en-US" DIR="LTR">
<H1>My favorite things</H1>
<p>
[Verse 1]
</p>
<p class="drop verse">
Gardening
<a class=tooltip href="https://en.wikipedia.org/wiki/Ungoliant">
spiders
<span class=tooltiptext>
Ungoliant, who took the form of a giant spider and, along with Dark Lord Melkor, destroyed the Two Trees of Valinor
</span>
</a>
<br>
And swords that are broken
<br>
Words in the Black Speech
<br>
That must not be spoken
<br>
Unfaithful stewards
<br>
Who don't want their kings
<br>
These are a few of
<br>
My favorite things.
</p>
<p>
[Verse 2]
</p>
<p class="drop verse">
<span class="drop tooltip">
Peddlers
<span class=tooltiptext>
a zone agent of the <q>Confederacy of Vega</q> in the story <q>Agent of Vega</q>
</span>
</span>
who drive their
Mysterious wagons
<br>
Petite young ladies
<br>
Who can speak to dragons
<br>
Travelling the Cosmos
<br>
In a
<a class=tooltip href="https://en.wikipedia.org/wiki/The_Ship_Who_Sang">
ship who sings
<span class=tooltiptext>
Helva is an intelligent girl born with a severely disabled body.
Her society trains people with such disabilities to operate machinery
via a direct brain link. In Helva's case, she is trained to
operate a spaceship (<q>brain ship</q>), and became known as
<q>The Ship Who Sings</q> due to her habit of singing to herself.
</span>
</a>
<br>
These are a few of
<br>
My favorite things.
</p>
<p>
[Verse 3]
</p>
<p class="drop verse">
<span class="drop tooltip">
Time traveling bar men
<span class=tooltiptext>
<q>‘—All You Zombies—’</q> from The Magazine of Fantasy & Science Fiction, March 1959
</span>
</span>
<br>
<span class=tooltip>
Who are like no others
<span class=tooltiptext>
The protagonist of <q>‘—All You Zombies—’</q> is
a bartender who, with the aid of a time machine and a sex change
operation, is his own father and own mother.
</span>
</span>
<br>
Who are their own fathers
<br>
And are their own mothers
<br>
Of all such stories
<br>
Know Heinlein's are kings
<br>
These are a few of
<br>
My favorite things.
</p>
<p>
[Verse 7]
</p>
<p class="drop verse">
<a class="drop tooltip" href="https://en.wikipedia.org/wiki/Kalvan_(Calvin_Morrison)">
Calvin
<span class=tooltiptext>
In Henry Beam Piper's novel <q>Lord Kalvan of Othewhen</q>, Calvin
Morrison is a Keystone cop who is accidentally taken into and
stranded in an alternate universe by a paratime transporter: he
later learns that the region is called the princedom of Hostigos.
The locals later have trouble with his American name and refer to
him as Lord Kalvan.
</span>
</a>
who knows his
<br>
Military history
<br>
Runs afoul of the great
<br>
Paratime mystery
<br>
The hand of a lovely
<br>
Young princess it brings
<br>
These are a few of
<br>
My favorite things.
</p>
</BODY>
</HTML>
1条答案
按热度按时间dgtucam11#
最佳的词是:*minimal*当您发布minimal reproducible example时。下面的例子与OP完全不同--两个段落--带有下拉式大写字母,并作为额外的工具提示链接。下拉盖的详细信息见图I。
图一
HTML
CSS
示例