美文网首页
css简单学习

css简单学习

作者: 饕餮潴 | 来源:发表于2018-08-16 18:19 被阅读14次
    css让标签更简洁

    引入css 样式:

    1.在标签中添加 style: 内联 <p style:clolor=red >1232145</p>
    2.<head>中添加<style>标签 通过标签 id class对应样式
    3.link引入外部标签
    4.在印日a外部css之前引入b.css

    css常用样式:

    请浮动: 常用与给元素加浮动的同时给其母元素清浮动使浮动效果正常显示
    clearfix::after{
    content:'';
    display:block
    clera:both
    }

    清理标签原始样式:

    html, body, div, span, object, iframe,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre,
    abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,
    small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li,
    fieldset, form, label, legend,
    table, caption, tbody, tfoot, thead, tr, th, td,
    article, aside, canvas, details, figcaption, figure,
    footer, header, hgroup, menu, nav, section, summary,
    time, mark, audio, video {
        border: 0;/*边框0*/
        margin: 0;/*外边距*/
        padding: 0;/*内边距0*/
        font-size: 100%;
        font-weight: inherit;  /*injerit 继承 normal 为去除加粗*/
        font-style: normal; 
        vertical-align: baseline;/*垂直对齐方式:baseline  与父元素水平*/
        background: transparent; /*背景透明*/
       outline: 0;
    }
    
    /* 用于html5 旧浏览器的重置*/  
    article, aside, figure, figure img, hgroup, footer, header, nav, section {
        display: block;
    }
    
    ol, ul {
        list-style: none;  <!--去掉列表圆点或者序列号-->
    }
    
    a {
        text-decoration: none;  <!--a标签去除下划线-->
    }
    

    元素高度决定:

    高度尤其内部文档流高度决定
    文档/标准 流:文档内文字流动方向
    内联元素:文字从左向右,如果宽度不够换行从左向右继续流动
    块元素:从上到下流动(块元素默认独占一行)
    内联元素高度实际高度:又字体高度和自己推荐的行间距决定(不同字体行间距不一定相同)所以内联元素一般使用规定行高(行高大于字体数值)

    height与width 最容易出现bug 所以能不加这两个就别加 尽量用元素内容撑
    推荐使用 max-width 最大宽度 ,当低于这个值是自适应
    内联元素换行:word-break:break work(将整个单词看成一个整体,如果该行末端宽度不够显示整个单词时,会自动把整个单词放到下一行,而不会把单词截断)
    word-break:break-all (当一个单词到达边界时,下个字母会自动到下一行)

    伪类:

    所有费控标签都有伪类
    :nth-child(even) 双数子标签
    :nth-child(odd)单数子标签
    :hover悬停
    :before之前 必须加content' ';否则不会出现
    :after之后 必须加content' ';否则不会出现
    :before :aft

    常见css学习网站;

    https://css-tricks.com/examples/ShapesOfCSS/ 用css回执各种图案

    相关文章

      网友评论

          本文标题:css简单学习

          本文链接:https://www.haomeiwen.com/subject/lxsobftx.html