在网页中添加语法高亮显示后,为什么滚动条不起作用?

时间:2016-11-04 07:26:58

标签: javascript jquery html syntax-highlighting syntaxhighlighter

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

我已经尝试了很多,但问题仍然存在。我使用了语法高亮显示器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>

1 个答案:

答案 0 :(得分:1)

将溢出滚动添加到漂亮的图纸

.prettyprint {
overflow:scroll;
}