muzuiget / dualsub-support

Dualsub - Dual Subtitles for YouTube
https://www.dualsub.xyz/
272 stars 23 forks source link

Text becomes bigger from second line onwards in subtitle 2 on Native Mode #583

Closed idanrm closed 4 months ago

idanrm commented 5 months ago

Hello,

I have noticed that whenever there is more than one line in the subtitle 2 part of Native Mode, the text becomes bigger (probably resorting to the default CC settings of YouTube).

It looks like this: image

(the font size of the line containing the text "thinking about" is bigger)

You can see it in this video in 18:15: https://www.youtube.com/watch?v=ZNwGH28_PeU&ab_channel=HowtolearnArabicwithSahar

Could you please look into it?

Thanks

muzuiget commented 5 months ago

This is expected. The HTML of YouTube's native subtitles uses inline styles(the style attribute), so custom CSS cannot override it:

 /* don't work, the `style` attribute in HTML has higher priority. */
.caption-visual-line:nth-child(2) > span {
    font-size: 80%;
}

But there is a hack: use the ::first-line pseudo-element:

.caption-visual-line:nth-child(2) > span::first-line {
    font-size: 80%;
}

That is why the font size of 2nd line is reverted back to 100%.