简体   繁体   English

谷歌美化线切片和白色背景

[英]Google prettifier line slicing and white background

When I add line numbers with more than 4 digit numbers it's lines are sliced out of the code box.当我添加超过 4 位数字的行号时,它的行被从代码框中切出。

When I use background-color: #eee;当我使用background-color: #eee; all works great but it works not for white colour background-color: #fff;一切都很好,但它不适用于白色background-color: #fff; . .

  1. How to fix line numbers slicing out of the code box?如何修复从代码框中切出的行号?

  2. How to change all lines background to white?如何将所有线条背景更改为白色?

PS White background has to be with line numbers:) PS白色背景必须带有行号:)

How it works right now (on picture: linenums:320 with 3 digit number it sliced badly only in Safari`, for Chrome it starts slicing since 4 digit numbers).它现在是如何工作的(在图片上: linenums:320带有 3 位数字,它仅在 Safari 中切片很糟糕,对于 Chrome,它从 4 位数字开始切片)。 But maybe we can make some margin or something else.但也许我们可以赚取一些利润或其他东西。

在此处输入图像描述

pre.prettyprint {
  background-color: #fff;
}
li.L0, li.L1, li.L2, li.L3, li.L4,
li.L5, li.L6, li.L7, li.L8, li.L9 {
  list-style-type: decimal;
} 
<pre class="prettyprint linenums:3320">
def celsius_from_fahrenheit(temp):
    """
    Convert temperature value from Fahrenheit to Celsius.
    """
    return (temp - 32)*5.0 / 9.0

def fahrenheit_from_celsius(temp_fahrenheit):
    """
    Convert temperature value from Celsius to Fahrenheit.
    """
    return (temp_fahrenheit*9 + 160)
</pre>

Here is the example where you can check how it works.这是您可以检查其工作原理的示例。 https://jsfiddle.net/rwjbdayu/7/ https://jsfiddle.net/rwjbdayu/7/

This is the answer that totally works for me.这是完全适合我的答案。 PS Safari bad visualize google prettifier PS Safari 坏形象化谷歌美化师

<style>
li.L0, li.L1, li.L2, li.L3, li.L4,
li.L5, li.L6, li.L7, li.L8, li.L9 
    {list-style-type: decimal !important; 
    background-color: #fff} 
</style>
<div class="google-auto-placed ap_container" style="text-align: left; width: 46%; height: auto; clear: none; margin: auto;">
    <pre class="prettyprint linenums:3320">
        def celsius_from_fahrenheit(temp):
            """
            Convert temperature value from Fahrenheit to Celsius.
            """
            return (temp - 32)*5.0 / 9.0

        def fahrenheit_from_celsius(temp_fahrenheit):
            """
            Convert temperature value from Celsius to Fahrenheit.
            """
            return (temp_fahrenheit*9 + 160)
    </pre>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM