html - 文本选择覆盖整个屏幕宽度

标签 html css

每当我在我的网站上选择/突出显示文本时,该栏会覆盖我页面上的所有内容。

Text Selction

(文本选择框实际上不是灰色的,只是需要截图)我怎样才能阻止它这样做,让它留在白色框中?

文本所在的白框使用“word-wrap: break-word”来阻止文本与白框重叠。不知道是不是这个问题。

<p> Test Test Test Test Test </p>

p {                         
font-family: "Calibri";
font-style: normal;
font-variant: normal;
font-size: 18px;
color: black; }

谢谢

最佳答案

只需为子 div 添加样式 oveflow: hidden;。 找到下面的例子

HTML

<div class="wrap">
    <div class="content">
        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled 
    </div>
</div>

CSS

.wrap{
    background: #ddd;
    overflow: hidden;
    padding: 20px;
}
.content{
    width: 50%;
    margin: 0 auto;
    background: #fff;
    overflow: hidden;
}

JSFIDDLE DEMO

关于html - 文本选择覆盖整个屏幕宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27950902/

相关文章:

javascript - 如何检测在javascript中单击了哪个按钮?

php - 当 CSS 表实现时,调用的超链接停止显示

css - Bootstrap 轮播上的奇怪运动

javascript - 似乎无法检查 chrome 开发人员工具或 Firebug 中的模式弹出窗口

html - 如何强制 DIV 中的元素占用尽可能多的水平空间?

jquery - 用于旧浏览器的 jquery 中的第 nth-child(4n)

java - [JSoup]如何访问标签内的值

html - 指南 : Full screen fixed layout webpage (header, 搜索栏、内容、事件列表和页脚)

javascript - 如何将自动播放添加到此 slider

html - Slider 的元素 h1 变量的位置,h2 静态重叠第一个