为什么在网页中添加语法高亮后滚动条不工作

Why scroll bar is not working after adding syntax highlighter in webpage?

本文关键字:滚动条 工作 高亮 语法 网页 添加 为什么      更新时间:2023-09-26

我在我的网页中应用了语法高亮,但是当我最小化窗口或在不同的屏幕上检查它时,文本就出来了。

我已经尝试了很多,但问题仍然发生。我已经使用了语法高亮笔形式的rawgit。

还有其他选择吗?

<!DOCTYPE HTML>
<html lang="en">
    <head>   
        <link rel="stylesheet" href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css"/>
        <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
    </head>
    <body>
        <pre class="prettyprint"><code>
package com.up;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
@Path("/files")
public class FileUploadService {
    @POST
    @Path("/upload")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Response uploadFile(
            @FormDataParam("file") InputStream uploadedInputStream,
            @FormDataParam("file") FormDataContentDisposition fileDetail
    ) {
        String fileLocation = "F://" + fileDetail.getFileName();
        try {
            FileOutputStream out = new FileOutputStream(new File(fileLocation));
            int read = 0;
            byte[] bytes = new byte[1024];
            out = new FileOutputStream(new File(fileLocation));
            while ((read = uploadedInputStream.read(bytes)) != -1) {
                out.write(bytes, 0, read);
            }
            out.flush();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        String output = "File successfully uploaded to : " + fileLocation;
        return Response.status(200).entity(output).build();
    }
} </code></pre>
    </body>
</html>

为您的prettyprint添加溢出滚动

.prettyprint {
overflow:scroll;
}