Title: CSS background: Letters like g,p outside background box
Tags: css;fonts;background;background-color
Question: I have the following scenario: I want a background with no padding behind a heading but certain letters - as g,p -  are outside the box.
Seems pretty simple but can't find a way to include all letters seamlessly:
No letter portion outside background box
No extra space/color on top of l's or capitals for example.
Can you please help?
background:#b2bec3;
color:#444;
display:block;
font-family:'Roboto';
font-weight:700;
line-height:1;
font-size:35px;
padding:0;
<h2&gt;This is a heading or a paragraph text</h2&gt;
Comment: this is simply impossible without JS (at least in a generic way), read this: https://stackoverflow.com/a/55978512/8620333

Comment: ^ don't forget that you have letters like `ÂÊ` and `_`

Comment: This really isn't too practical but changing the lineheight to 1.4 would get you part of the way. Text is **supposed** to have space above and below to separate it from other text lines.


Here is another answer: Like @Temani Afif said in the comment below your post, you'll have to delve into JS.
Best option is to bump up your line height slightly
line-height: 1.2;

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 3, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2021:00:03/09/21', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<css><fonts><background><background-color>', 'Title': 'CSS background: Letters like g,p outside background box', 'ViewCount': 95, 'id': 66555087, 'user_AboutMe': "<p>My name is Giannis Dallas</p>\n\n<p>I am a Web developer specializing in WordPress. Currently, I currently work for Mosaic Data Services firm .</p>\n\n<p>I am a very passionate web developer. In less than a year I learned WordPress, PHP, MySQL database handling and of course HTML CSS and JavaScript.</p>\n\n<p>I also created and manage my first personal site www.betterparents.gr with X-theme. It's on parenting. I have build several other sites in Greece and US using X-theme</p>\n", 'user_AccountId': 7273942.0, 'user_DisplayName': 'Giannis Dallas', 'user_Reputation': 648.0, 'user_Views': 107.0, 'user_id': 5545991.0}}