CSS相关知识和经验的碎片化记录
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相关知识和经验的碎片化记录的更多相关文章
- React相关知识和经验的碎片化记录
React相关知识和经验的碎片化记录 1.Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a chil ...
- 开发工具Visual Studio使用相关知识和经验的碎片化记录
开发工具Visual Studio使用相关知识和经验的碎片化记录 1.Visual Studio提示"无法启动IIS Express Web服务器"的解决方法 有时,在使用Visu ...
- HTML相关知识和经验的碎片化记录
1.标签input在type="file"时,name是必须属性 <form id="MainFileUpload" name="MainFil ...
- WinForm(C#)相关知识和经验的碎片化记录
1.引发类型为“System.Windows.Forms.AxHost+InvalidActiveXStateException”的异常 出现"System.Windows.Forms.Ax ...
- windows cmd命令相关知识和经验的碎片化记录
1.循环遍历当前文件夹下的所有*.dll文件,并打印其绝对路径和相对路径 ``` for /f "tokens=*" %%a in ('dir /s/b/a-d "*.d ...
- IIS相关知识和经验的碎片化记录
1.IIS(Internet Information Services)网站本机可以访问,局域网其他机器无法访问 导致这个问题之一是防火墙规则,解决办法如下: [开始]打开[控制面板],选择[WIND ...
- AngularJs(v1)相关知识和经验的碎片化记录
1.利用angular指令监听ng-repeat渲染完成后执行脚本 http://www.cnblogs.com/wangmeijian/p/5141266.html 2.$http的POST请求中请 ...
- Asp.net相关知识和经验的碎片化记录
1.解决IIS7.0下“HTTP 错误 404.15 - Not Found 请求筛选模块被配置为拒绝包含的查询字符串过长的请求”问题 方案1:在程序的web.config中system.web节点里 ...
- SQL Server相关知识和经验的碎片化记录
1.在向服务器发送请求时发生传输级错误 在向服务器发送请求时发生传输级错误. (provider: TCP 提供程序, error: 0 - 远程主机强迫关闭了一个现有的连接.) ---> Sy ...
随机推荐
- C++中关于strtok()函数的用法
strtok: #include <string.h> char *strtok(char *str, const char *delim); char *strtok_r(char *s ...
- 网络爬虫必备知识之concurrent.futures库
就库的范围,个人认为网络爬虫必备库知识包括urllib.requests.re.BeautifulSoup.concurrent.futures,接下来将结对concurrent.futures库的使 ...
- 以前的实验博客地址,以前使用csdn
实验一木马分析(隐藏分析)实验 http://blog.csdn.net/qq_30600405/article/details/78360599 实验二木马分析(控制分析)实验和实验三冰河木马实验 ...
- [ Laravel 5.5 文档 ] 处理用户请求 —— HTTP 请求的过滤器:中间件
[ Laravel 5.5 文档 ] 处理用户请求 —— HTTP 请求的过滤器:中间件 http://laravelacademy.org/post/7812.html 简介 中间件为过滤进入应用的 ...
- JSplitPane的简单实现
import java.awt.Color; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.J ...
- angularjs控制输入框只输入数字及最多输入两位小数
ps:示例中作用在循环中,其它的你可以按实际需求进行修改使用 <input type="text" ng-model="item.productNumber&quo ...
- Python函数-input()
input([prompt]) 如果[prompt]是存在的,它被写入标准输出中没有换行.然后函数读取输入,将其转换为一个字符串,然后返回. >>> s = input('--> ...
- 第四篇 PHP的成长路线
学PHP开发这么久,进步不大,个人进行了分析.认为是我自己没有设定目标,就是对于自己要学成什么样没有清晰的认识. 今天特别了解了一下PHP的成长参考路线,以便自己以后迷失方向.PHP主要应该基于MYS ...
- error: cast from ‘char*’ to ‘int’ loses precision
程序: char* addrCom; addrCom= ......//赋值 == (int)addrCom) //导致编译出错 { ...... } 编译时出现错误: error: cast fro ...
- Fiddler 使用技巧
1.Host重定向,将192.10.11.12:8091的地址重新定向到127.0.0.1:8080 if (oSession.host=="192.10.11.12:8091") ...