首页 \ 问答 \ CSS / HTML:窗口中的中心文本没有滚动条(CSS/HTML: Center text in window without scroll bars)

CSS / HTML:窗口中的中心文本没有滚动条(CSS/HTML: Center text in window without scroll bars)

我到处寻找在窗口中居中文本,我相信我找到了最好的解决方案(我相信......我还有其他的建议)。 但是,无论窗口有多大或多小,我都会在两侧看到这些恼人的滚动条。

你们可以看看这个代码/小提琴,让我知道为什么滚动条在那里以及如何删除它们?

<!DOCTYPE html>
<html>
  <head>
    <link href='http://fonts.googleapis.com/css?family=Sigmar+One' rel='stylesheet'       type='text/css'>
  <style>
    body {
        font-family: 'Asset', cursive;
        font-size: 100px;
        text-shadow: 4px 4px 4px #aaa;

        width: 100%;
        height: 100%;
    }

    div {
        position:absolute; 
        height:100%; 
        width:100%;
        display: table;
    }

    h1 {
        display: table-cell;
        vertical-align: middle;
        text-align:center;
    }

  </style>
  </head>
  <body>
    <div>
    <h1>HELLO</h1>
    </div>
  </body>
</html>

http://jsfiddle.net/rYe7V/


I've looked everywhere to center text in a window and I believe I found the best solution (I believe... I'm up for other suggestions). However, I get these annoying scroll bars on both sides no matter how large or small the window is.

Can you guys take a look at this code/fiddle and let me know why the scroll bars are there and how to remove them?

<!DOCTYPE html>
<html>
  <head>
    <link href='http://fonts.googleapis.com/css?family=Sigmar+One' rel='stylesheet'       type='text/css'>
  <style>
    body {
        font-family: 'Asset', cursive;
        font-size: 100px;
        text-shadow: 4px 4px 4px #aaa;

        width: 100%;
        height: 100%;
    }

    div {
        position:absolute; 
        height:100%; 
        width:100%;
        display: table;
    }

    h1 {
        display: table-cell;
        vertical-align: middle;
        text-align:center;
    }

  </style>
  </head>
  <body>
    <div>
    <h1>HELLO</h1>
    </div>
  </body>
</html>

http://jsfiddle.net/rYe7V/


原文:https://stackoverflow.com/questions/18164754
更新时间:2023-01-15 16:01

最满意答案

返回类型实际上是InputStream的InputStream还是子类?

是的,抽象类无法实例化,返回的对象将是InputStream子类的类型,您可以在此处从API中找到InputStream的子类


Is the return type is actually InputStream or subclass of InputStream?

Yes, abstract classes can't be instantiated and the returned object will be the type of the subclass of InputStream, you can find the subclasses of the InputStream from the API here

相关问答

更多
  • 首先你需要了解的是STREAM 一个流可以被定义为一个数据序列。 InputStream用于从源读取数据,OutputStream用于将数据写入目标。 ****接下来是流的类型**** we have byte stream and character stream. classes we have in Input Stream and output stream 顾名思义, 简单来说,输入流用于输入数据,输出流用于输出数据 Java 字节流用于执行8位字节的输入和输出。 尽管有许多与字节流相关的 ...
  • 我保持着gmpy和gmpy2。 @cartman和@DJV已经引导你到源代码,但我会添加一些注释。 mpz_probab_prime_p试验因子分析,然后进行Miller-Rabin检验的多次迭代。 Miller-Rabin测试不能证明一个数是素数,它非常擅长证明一个数是复合的。 如果你多次重复测试,那么这个数字很可能是最好的。 在已知的情况下, mpz_probab_prime_p在仅完成12到15次迭代时报告复合是素数。 更有趣的素性测试是BPSW测试。 没有已知的复合材料被报告为素数,但它推测它们存在 ...
  • 如果您的编译生成警告,但是从Java运行时没有看到警告,则警告将写入STDERR,并且您不会使用STDERR。 根据错误输出的数量,当缓冲区运行满时,make进程可能已停止。 如果Process是使用ProcessBuilder创建的,那么您应该调用redirectErrorStream(true)将错误输出与标准输出合并。 If your compilation generates warnings, but you don't see the warnings when run from Java, t ...
  • 您需要实现UIWebViewDelegate方法 - (void)webViewDidFinishLoad:(UIWebView *)webView并设置self.webView.delegate = self; 把你的代码NSString *yourHTMLSourceCodeString = [webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.innerHTML"]; 这个方法 You need imple ...
  • 在第二节课,你会打电话 try{ ClassA.Connect(); } catch(Exception e) { } 其中ClassA是定义public static void Connect()的类的名称。 请注意,按照惯例,方法名称应以小写字母开头,因此它应该是public static void connect()。 In the second class, you would call try{ ClassA.Connect(); } catch(Exception e) { ...
  • 那是因为ServletResponse / HttpServletResponse没有getInputStream() 。 您可能实际上想要使用来自HttpServletRequest getInputStream 。 request.getInputStream() That's because ServletResponse/HttpServletResponse doesn't have the getInputStream(). You might actually want to use get ...
  • 返回类型实际上是InputStream的InputStream还是子类? 是的,抽象类无法实例化,返回的对象将是InputStream子类的类型,您可以在此处从API中找到InputStream的子类 Is the return type is actually InputStream or subclass of InputStream? Yes, abstract classes can't be instantiated and the returned object will be the type ...
  • 你必须打电话: clientSocket.getOutputStream() clientSocket.getInputStream() 在DataOutput- / DataInputStream构造函数中。 You have to call: clientSocket.getOutputStream() clientSocket.getInputStream() inside your DataOutput-/DataInputStream constructors.
  • 看来你有点新鲜。 现在要更改滑块或菜单,您可以使用管理面板或源代码执行它们,具体取决于网站的编码方式。 由于您只有后端访问权限,因此目前无法获取源代码。 您可以请求您的站点管理员获取代码,一旦您拥有它,您可以转到root / app / design / frondend / [your-package] / [your-template] /template/page/html/header.phtml并查看如果你能看到菜单项。 如果没有,那么搜索和cms语法,你可以看到,如果你找到一个,复制名称并转到后 ...
  • 连接响应代码为200 不,不是。 此代码中没有任何内容可以检查响应代码。 FileNotFoundException表示响应代码为404。 NB setDoOutput(true)将方法设置为POST。 你不需要自己设定, The connection response code is 200 No it isn't. There is nothing in this code that checks the response code. A FileNotFoundException means a re ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)