1、子DIV块中设置margin-top时影响父DIV块位置的问题

  解决办法1:若子DIV块中使用margin-top,则在父DIV块中添加:overflow:hidden;
  解决办法2:在子DIV块中用padding-top代替margin-top。

2、在IE浏览器上div元素块不能对ActiveX控件界面进行遮挡的问题

  解决办法:在div元素块中添加子元素iframe,并设置其相应的样式和属性,如:

<div id="preLoadMask" class="ui_preLoadMask">
  <iframe style="position:absolute;z-index:-1;width:100%;height:100%;top:0;left:0;scrolling:no;filter:alpha(opacity=0);opacity:0.5;" frameborder="0"></iframe>
</div>

3、使div在浏览器窗口居中

.cls {
position: absolute;
top: 50%;
left: 50%;
width: 32px;
height: 32px;
margin: auto; /*重要,IE兼容模式*/
margin-top: -16px;
margin-left: -16px;
}

4、通过CSS样式让页面的内容不能被选中

body{
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
}

5、不同浏览器下p等元素中的文本(中文)无法自动换行导致溢出问题

解决办法1(缺点:不支持火狐):

word-wrap: break-word;
word-break: break-word;

解决办法2(缺点:英文单词被拆分):

word-wrap: break-word;
word-break: break-all;

解决办法3:

word-wrap: break-word;
word-break: normal;

word-break:break-all;所有浏览器都支持;

word-wrap:用来标明是否允许浏览器在单词内进行断句,这是为了防止当一个字符串太长而找不到它的自然断句点时产生溢出现象;

word-break:用来标明怎么样进行单词内的断句。

详细参考:你真的了解word-wrap和word-break的区别吗?

6、多个div等元素横向排列,显示横向滚动条

<!DOCTYPE html>

<html>
<header></header>
<body>
<div style="width:500px;height:100px;background:yellow; overflow-x: scroll;overflow-y: hidden;white-space: nowrap;"> <div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div>
<div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div>
<div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div>
<div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div>
<div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div>
<div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div>
<div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div>
<div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div>
<div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div>
<div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div>
<div style="width:50px;height:50px;background:red; display:inline-block;">
123
</div> </div>
</body>
</html>

注意父元素的 white-space: nowrap; 样式和子元素的 display:inline-block; 样式

......

CSS相关知识和经验的碎片化记录的更多相关文章

  1. React相关知识和经验的碎片化记录

    React相关知识和经验的碎片化记录 1.Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a chil ...

  2. 开发工具Visual Studio使用相关知识和经验的碎片化记录

    开发工具Visual Studio使用相关知识和经验的碎片化记录 1.Visual Studio提示"无法启动IIS Express Web服务器"的解决方法 有时,在使用Visu ...

  3. HTML相关知识和经验的碎片化记录

    1.标签input在type="file"时,name是必须属性 <form id="MainFileUpload" name="MainFil ...

  4. WinForm(C#)相关知识和经验的碎片化记录

    1.引发类型为“System.Windows.Forms.AxHost+InvalidActiveXStateException”的异常 出现"System.Windows.Forms.Ax ...

  5. windows cmd命令相关知识和经验的碎片化记录

    1.循环遍历当前文件夹下的所有*.dll文件,并打印其绝对路径和相对路径 ``` for /f "tokens=*" %%a in ('dir /s/b/a-d "*.d ...

  6. IIS相关知识和经验的碎片化记录

    1.IIS(Internet Information Services)网站本机可以访问,局域网其他机器无法访问 导致这个问题之一是防火墙规则,解决办法如下: [开始]打开[控制面板],选择[WIND ...

  7. AngularJs(v1)相关知识和经验的碎片化记录

    1.利用angular指令监听ng-repeat渲染完成后执行脚本 http://www.cnblogs.com/wangmeijian/p/5141266.html 2.$http的POST请求中请 ...

  8. Asp.net相关知识和经验的碎片化记录

    1.解决IIS7.0下“HTTP 错误 404.15 - Not Found 请求筛选模块被配置为拒绝包含的查询字符串过长的请求”问题 方案1:在程序的web.config中system.web节点里 ...

  9. SQL Server相关知识和经验的碎片化记录

    1.在向服务器发送请求时发生传输级错误 在向服务器发送请求时发生传输级错误. (provider: TCP 提供程序, error: 0 - 远程主机强迫关闭了一个现有的连接.) ---> Sy ...

随机推荐

  1. 3.18 CCProgressTo 进度计时器

    CCProgressTimer * pross = CCProgressTimer::create(CCSprite::create("Icon.png")); pross-> ...

  2. PHP提供的数组比较函数总结

    在我们看PHP手册的时候发现,PHP提供了许多数组元素比较的函数,看起来又多又烦又不好记,现在我们来总结一下: sort() — 本函数对数组进行排序,当本函数结束时数组单元将被从最低到最高重新安排. ...

  3. CodeForces - 650D:Zip-line (LIS & DP)

    Vasya has decided to build a zip-line on trees of a nearby forest. He wants the line to be as long a ...

  4. LeetCode Image Smoother

    原题链接在这里:https://leetcode.com/problems/image-smoother/description/ 题目: Given a 2D integer matrix M re ...

  5. LeetCode Reshape the Matrix

    原题链接在这里:https://leetcode.com/problems/reshape-the-matrix/#/description 题目: In MATLAB, there is a ver ...

  6. django的settings文件

    转载:http://www.cnblogs.com/likeshan168/articles/3596344.html

  7. 自动化框架httpClient实例

    package com.auto.test.util; import java.net.SocketException;import java.net.SocketTimeoutException;i ...

  8. 如何用nodejs启一个前端服务

    1.新建文件夹,如 notice 2.新建页面和js文件,如 index.html server.js 3.index.html页面内容随你写,如: <!DOCTYPE html> < ...

  9. 蓝桥杯 算法训练 ALGO-126 水仙花

    算法训练 水仙花   时间限制:1.0s   内存限制:256.0MB 水仙花数 问题描述 判断给定的三位数是否 水仙花 数.所谓 水仙花 数是指其值等于它本身 每位数字立方和的数.例 153 就是一 ...

  10. 蓝桥杯 算法训练 ALGO-145 4-1打印下述图形

     算法训练 4-1打印下述图形   时间限制:1.0s   内存限制:256.0MB 问题描述 使用循环结构打印下述图形,打印行数n由用户输入.打印空格时使用"%s"格式,向pri ...