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

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

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

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

  1. <div id="preLoadMask" class="ui_preLoadMask">
  2.   <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在浏览器窗口居中

  1. .cls {
  2. position: absolute;
  3. top: 50%;
  4. left: 50%;
  5. width: 32px;
  6. height: 32px;
  7. margin: auto; /*重要,IE兼容模式*/
  8. margin-top: -16px;
  9. margin-left: -16px;
  10. }

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

  1. body{
  2. -webkit-user-select:none;
  3. -moz-user-select:none;
  4. -ms-user-select:none;
  5. user-select:none;
  6. }

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

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

  1. word-wrap: break-word;
  2. word-break: break-word;

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

  1. word-wrap: break-word;
  2. word-break: break-all;

解决办法3:

  1. word-wrap: break-word;
  2. word-break: normal;

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

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

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

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

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

  1. <!DOCTYPE html>
  2.  
  3. <html>
  4. <header></header>
  5. <body>
  6. <div style="width:500px;height:100px;background:yellow; overflow-x: scroll;overflow-y: hidden;white-space: nowrap;">
  7.  
  8. <div style="width:50px;height:50px;background:red; display:inline-block;">
  9. 123
  10. </div>
  11. <div style="width:50px;height:50px;background:red; display:inline-block;">
  12. 123
  13. </div>
  14. <div style="width:50px;height:50px;background:red; display:inline-block;">
  15. 123
  16. </div>
  17. <div style="width:50px;height:50px;background:red; display:inline-block;">
  18. 123
  19. </div>
  20. <div style="width:50px;height:50px;background:red; display:inline-block;">
  21. 123
  22. </div>
  23. <div style="width:50px;height:50px;background:red; display:inline-block;">
  24. 123
  25. </div>
  26. <div style="width:50px;height:50px;background:red; display:inline-block;">
  27. 123
  28. </div>
  29. <div style="width:50px;height:50px;background:red; display:inline-block;">
  30. 123
  31. </div>
  32. <div style="width:50px;height:50px;background:red; display:inline-block;">
  33. 123
  34. </div>
  35. <div style="width:50px;height:50px;background:red; display:inline-block;">
  36. 123
  37. </div>
  38. <div style="width:50px;height:50px;background:red; display:inline-block;">
  39. 123
  40. </div>
  41.  
  42. </div>
  43. </body>
  44. </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. C++中关于strtok()函数的用法

    strtok: #include <string.h> char *strtok(char *str, const char *delim); char *strtok_r(char *s ...

  2. 网络爬虫必备知识之concurrent.futures库

    就库的范围,个人认为网络爬虫必备库知识包括urllib.requests.re.BeautifulSoup.concurrent.futures,接下来将结对concurrent.futures库的使 ...

  3. 以前的实验博客地址,以前使用csdn

    实验一木马分析(隐藏分析)实验 http://blog.csdn.net/qq_30600405/article/details/78360599 实验二木马分析(控制分析)实验和实验三冰河木马实验 ...

  4. [ Laravel 5.5 文档 ] 处理用户请求 —— HTTP 请求的过滤器:中间件

    [ Laravel 5.5 文档 ] 处理用户请求 —— HTTP 请求的过滤器:中间件 http://laravelacademy.org/post/7812.html 简介 中间件为过滤进入应用的 ...

  5. JSplitPane的简单实现

    import java.awt.Color; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.J ...

  6. angularjs控制输入框只输入数字及最多输入两位小数

    ps:示例中作用在循环中,其它的你可以按实际需求进行修改使用 <input type="text" ng-model="item.productNumber&quo ...

  7. Python函数-input()

    input([prompt]) 如果[prompt]是存在的,它被写入标准输出中没有换行.然后函数读取输入,将其转换为一个字符串,然后返回. >>> s = input('--> ...

  8. 第四篇 PHP的成长路线

    学PHP开发这么久,进步不大,个人进行了分析.认为是我自己没有设定目标,就是对于自己要学成什么样没有清晰的认识. 今天特别了解了一下PHP的成长参考路线,以便自己以后迷失方向.PHP主要应该基于MYS ...

  9. error: cast from ‘char*’ to ‘int’ loses precision

    程序: char* addrCom; addrCom= ......//赋值 == (int)addrCom) //导致编译出错 { ...... } 编译时出现错误: error: cast fro ...

  10. Fiddler 使用技巧

    1.Host重定向,将192.10.11.12:8091的地址重新定向到127.0.0.1:8080 if (oSession.host=="192.10.11.12:8091") ...