logo
down
shadow

CSS: font statement causes line-height not to work


CSS: font statement causes line-height not to work

Content Index :

CSS: font statement causes line-height not to work
Tag : html , By : jch
Date : November 22 2020, 12:01 PM

help you fix your problem It is no bug, it's the way you are declaring the short hand syntax is resetting the line-height
#outer-bug {
    font: bold 15px/32px Arial;
               /* ---^--- line-height */
}

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Where we should declare font size, line height and font-family to body, before css reset or after?


Tag : css , By : jch
Date : March 29 2020, 07:55 AM
wish helps you If you don’t reset any font property that is set within your mentioned font rule, it doesn’t matter whether you put it before or after the reset as it won’t be altered by the reset.

Regular expression in C# to replace font-size, font-family, line-height, etc


Tag : chash , By : Kilimanjaro
Date : March 29 2020, 07:55 AM
Any of those help Currently I'm eliminating certain formatting tags from HTML strings, and would like to learn enough about regular expressions to be able to replace any formatting. For starters, this is what I've done, but I'd like it to work with any font size, family, etc: , Helper function
    public static string RemoveStyle(string html, string style)
    {
        Regex regex = new Regex(style + "\\s*:.*?;?");

        return regex.Replace(html, string.Empty);
    }
string input = "color: red ; line-height: 10px  ; font-family: Arial, Helvetica, sans;  ";
input = RemoveStyle(input, "line-height");
input = RemoveStyle(input, "font-family");

// now, input = "color: red ;"

The exact height of a text line (font-size + line-height)


Tag : html , By : Mario Tristan
Date : March 29 2020, 07:55 AM
wish helps you line-height works only with the block-level elements, which mean you need to apply display: block; or display: inline-block; to your span to have line-height working. Hope this helps.
http://jsfiddle.net/ghxgouba/3/
span {
    font-size: 50px;
    line-height: 50px;
    background: darkblue;
    color: #fff;
    font-family: Arial;
    display: inline-block;
}
img {
    vertical-align: top;
}
#ret {
    margin-top: 30px;
}

font-size and line-height set, but changing font still makes an element's height change


Tag : css , By : Francesco
Date : March 29 2020, 07:55 AM
help you fix your problem I ended up solving my own problem (to an acceptable extent) by simply tweaking with the font family and size until it worked for me:
body {
  font-size: 15px;
  line-height: 1.2;
}

body, .same-font {
  font-family: Helvetica, sans-serif;
}

code {
  font-family: Menlo, Courier New, sans-serif;
  font-size: 0.9333em; /* 14/15 */
  line-height: 1.28571; /* 18/14 */
}
<ul>
  <li>Without any code - 18px height.</li>
  <li>With <code>code</code> - 18px height.</li>
  <li>With <code class="same-font">code.same-font</code> - 18px height.</li>
</ul>

Outlook 2016 - first line with default line-height, mso-line-height-rule doesn't work


Tag : css , By : Boris
Date : March 29 2020, 07:55 AM
may help you . Finally I found some workaround solution... below you can find simplyfied example.
Option 1 (hidden
with some text, w/o mso-hide: all style):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="cs" xml:lang="cs">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <style>
            table {
                border-collapse: collapse; 
                border-spacing: 0px;
            }
        </style>
    </head>
    <body>
        <div style="overflow:hidden; color:transparent; visibility:hidden; width:0; font-size:0; opacity:0; height:0; line-height:0;">Some not visible text</div>
        <table cellpadding="0" cellspacing="0" border="0">
            <tbody>
                <tr height="1">
                    <td colspan="3" style="background-color: red;"></td>
                </tr>
                <tr>
                    <td width="1" style="background-color: blue;"></td>
                    <td width="160" style="background-color: yellow;">Some very nice text!<br />With 2 lines!</td>
                    <td width="1" style="background-color: blue;"></td>
                 </tr>
                 <tr height="1">
                    <td colspan="3" style="background-color: red;"></td>
                 </tr>
            </tbody>
        </table>
    </body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="cs" xml:lang="cs">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <style>
            table {
                border-collapse: collapse; 
                border-spacing: 0px;
            }
        </style>
    </head>
    <body>
        <div style="overflow:hidden; color:transparent; visibility:hidden; mso-hide:all; width:0; font-size:0; opacity:0; height:0; line-height:0;">Some not visible text</div>
        <table cellpadding="0" cellspacing="0" border="0">
            <tbody>
                <!--[if gte mso 9]>
                <tr height="0">
                    <td colspan="3" style="background-color: transparent;"></td>
                </tr>
                <![endif]-->
                <tr height="1">
                    <td colspan="3" style="background-color: red;"></td>
                </tr>
                <tr>
                    <td width="1" style="background-color: blue;"></td>
                    <td width="160" style="background-color: yellow;">Some very nice text!<br />With 2 lines!</td>
                    <td width="1" style="background-color: blue;"></td>
                 </tr>
                 <tr height="1">
                    <td colspan="3" style="background-color: red;"></td>
                 </tr>
            </tbody>
        </table>
    </body>
</html>
Related Posts Related QUESTIONS :
  • how to fix link tag in html after changing css
  • How do I add a top padding to the second row?
  • Is it possible to split XML into multiple HTML pages with page navigation?
  • AngularJS: responsive height in bootstrap
  • Hide second line of text with CSS
  • repeating-linear-gradient not working in Edge browser and internet Explorer Browser
  • how to make search and form category merges like amazon on bootstrap
  • Bootstrap: Rearranging rows into columns and changing the order of elements
  • How can I move a label under a text box?
  • How save LinearGradient To database
  • How to reposition an image with a linear gradient using css?
  • HTML audio will not play when page opened by batch file
  • CSS Three Tone Diagonal Background
  • How to use slots inside of template components in HTML
  • Using span tags in meta description & title, for dual languages
  • How to make an icon/span selectable by pressing Tab key?
  • Add dynamic margins using UI Kit
  • Add margin-top to textbox
  • What is the correct semantic HTML markup for a title (book, movie, etc.), according to the spec? Is it an <em> tag
  • How to make an animation in Geoserver or in Leaflet
  • Buttons overlapping when shrinking window
  • Stretch an element to the end of the automatically calculated grid, not just the explicit grid
  • What relation is there between Angular's <ng-content> and ShadowDOM
  • CSS background for div element is not working
  • CSS Marquee: multiple paragraphs overlaps
  • I want to align search bar to extreme right
  • Getting blank white space to the left of content inside pre tags
  • My viewer.html won't load any css and jss files
  • How to apply multiple styles to HTML to only part of a title?
  • Want to make text div transparent on a parallax area
  • Is there a way to make this ID plus descendants CSS rule less specific?
  • Is there a way to drop in a stylesheet to get a Material theme or similar for all form elements on the page?
  • How do I make a sideways L look in html/css?
  • Why won't the color #e67d22e1 display in Safari?
  • How to select specific tag's attribute value with xPath?
  • How to make div rows fill available height
  • How to fix text inside a block that grows
  • svg hexagon halftone pattern
  • How to edit a website's element's background colors using a chromium extention
  • What is the main tag in HTML5 ? How does it differ from body tag?
  • My image is flowing out from my div column. How I can fix it and made the image full-size into div
  • How to draw line in react
  • Why Transition css is not working in child selector css
  • How to modify materialize css select option?
  • How to center some text in a rectangle in CSS?
  • How do I equally space out css grid columns?
  • How to make sure all the parts of a macro are running correctly?
  • How to adjust the zoom of website at different browser at different screen size?
  • Can't set max height on child div properly
  • Why background color is not applying to DIV container?
  • Need to select the first-child
  • No space between attributes in buttons
  • How can I block google from crawling my page, but still let Baidu do it?
  • Rendering html content in matToolTip (Angular)
  • Embedding an iframe when iframe height is variable
  • How to use 'word-break: break-word' with link inside of text?
  • How I can animate circular progress bar from left to right?
  • Angular 6 - How can I hide a div onclick of outside of that div
  • How to fill an inline-block div with a solid color?
  • Form file doesn't align with rest of form
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com