zoukankan      html  css  js  c++  java
  • Day8:html和css

    标题图

    Day8:htmlcss

    显示和隐藏:

    display: none 为 无,隐藏元素
    display: block 为 显示元素 转换为块级元素

    visibility: visible 显示
    visibility: hidden 隐藏

    disvis的区别:

    dispaly 不占位置
    visibility 站位置

    overflow:

    hidden 溢出的部分隐藏掉
    visible 显示
    auto 自动 超出的就显示滚动条,不超出不显示
    scroll 总是显示滚动条

    用户界面:

    cursor鼠标样式

    default 小白
    text 文本
    move 移动
    pointer 小手

    轮廓线:

    outline: 0 或者为 none;

    防止文本域拖拽:

    resize: none;

    vertical-align: 和行内块使用

    溢出文字部分显示省略号

    white-space: nowrap 文字一行显示

    溢出部分隐藏: overflow: hidden

    text-overflow: ellipsis 超出部分以省略号显示

    字体图标iconfont

    icomoon字库

    http://www.iconfont.cn/

    阿里icon font字库

    `http://www.iconfont.cn/

    fontello

    http://fontello.com/

    Font-Awesome

    http://fortawesome.github.io/Font-Awesome/

    字体图标

    1. 设计字体图标
    2. 上次生产字体包
    3. 下载兼容字体包
    4. 字体引入到html
    // fonts
    iconfont.eot
    iconfont.svg
    iconfont.ttf
    iconfont.woff
    

    效果

    效果

    span {
     font-family: "icomoon";
    }
    
    span: before {
     content: "e900";
    }
    
    // 字体下载目录
    demo-filles
    fonts
    demo.html
    ReadMe.txt
    selection.json
    style.css
    

    上传生成字体包

    http://icomoom.io
    http://www.iconfont.cn/
    http://www.iconfont.cn/
    
    https://www.xxx.com/favicon.ico
    
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
    
    // 对浏览器
    <link rel="stylesheet" href="css/normalize.css"/>
    // 对头部和底部样式
    <link rel="stylesheet" href="css/base.css"/>
    // 首页
    <link rel="stylesheet" href="css/index.css"/>
    

    我是文字

    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>Demo</title>
    	<style>
    	body {
    		line-height: 1.5;
    	}
    	div {
    		font-size: 16px;
    	}
    	</style>
    </head>
    <body>
    	<div>
    		 我是文字
    	</div>
    </body>
    </html>
    

    行高不带单位

    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>Demo</title>
    	<style>
    		body {
    			line-height: 1.5;
    		}
    		div {
    			font-size: 16px;
    		}
    	</style>
    </head>
    <body>
    	<div>行高不带单位</div>
    </body>
    </html>
    

    复习

    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>Demo</title>
    </head>
    <body>
    	<a href="#">
    		<span>首页</span>
    	</a>
    	<input type="text">
    	<textarea name="" id="" cols="30" rows="10"></textarea>
    </body>
    </html>
    

    元素的定位属性

    边偏移属性 描述
    top 顶端偏移量,定义元素相对于其父元素上边线的距离
    bottom 底部偏移量,定义元素相对于其父元素下边线的距离
    left 左侧偏移量,定义元素相对于其父元素左边线的距离
    right 右侧偏移量,定义元素相对于其父元素右边线的距离

    position属性的常用值

    描述
    static 自动定位
    relative 相对定位
    absolute 绝对定位
    fixed 固定定位

    静态定位唯一的用处:
    就是 取消定位。

    position: static;
    

    叠放次序(z-index

    元素的显示与隐藏

    display visibilityoverflow

    display 显示

    display 设置或检索对象是否及如何显示。

    visibility 可见性

    设置或检索是否显示对象。

    overflow 溢出

    检索或设置当对象的内容超过其指定高度及宽度时如何管理内容。

    visible :  不剪切内容也不添加滚动条。
    
    auto :   超出自动显示滚动条,不超出不显示滚动条
    
    hidden :  不显示超过对象尺寸的内容,超出的部分隐藏掉
    
    scroll :  不管超出内容否,总是显示滚动条
    

    鼠标样式cursor

    <ul>
      <li style="cursor:default">我是小白</li>
      <li style="cursor:pointer">我是小手</li>
      <li style="cursor:move">我是移动</li>
      <li style="cursor:text">我是文本</li>
    </ul>
    

    轮廓 outline

    outline : outline-color ||outline-style || outline-width 
    

    防止拖拽文本域resize

    <textarea  style="resize: none;"></textarea>
    

    vertical-align 垂直对齐

    vertical-align : baseline |top |middle |bottom 
    

    white-space

    white-space设置或检索对象内文本显示方式
    

    text-overflow 文字溢出

    text-overflow : clip | ellipsis
    
    clip :  不显示省略标记(...),而是简单的裁切 
    
    ellipsis :  当对象内文本溢出时显示省略标记(...)
    

    经典布局

    <li>
      <a href="#">
        <span>导航栏内容</span>
      </a>
    </li>
    

    上传生成字体包

    推荐网站: http://icomoon.io
    
    阿里icon font字库
    http://www.iconfont.cn/
    
    http://fontello.com/
    
    http://fortawesome.github.io/Font-Awesome/
    
    http://glyphicons.com/
    
    https://icons8.com/
    

    目录说明

    名称 说明
    css 用于存放CSS文件
    images 用于存放图片
    index 京东首页 HTML
    js 用于后期存放javascript文件

    引入ico图标

    <img src="media/ico.png"  style="border: 1px dashed #ccc; padding:3px;" />  
    
    <link rel="shortcut icon" href="favicon.ico"  type="image/x-icon"/> 
    

    网页title 标题

    Description 网站说明

    Keywords 关键字

    如果看了觉得不错

    点赞!转发!

    达叔小生:往后余生,唯独有你
    You and me, we are family !
    90后帅气小伙,良好的开发习惯;独立思考的能力;主动并且善于沟通
    简书博客: 达叔小生
    https://www.jianshu.com/u/c785ece603d1

    结语

    • 下面我将继续对 其他知识 深入讲解 ,有兴趣可以继续关注
    • 小礼物走一走 or 点赞
  • 相关阅读:
    Spring Boot 入门实战(7)--JdbcTempalte、Mybatis、动态数据源及 Atomicos 整合(XA 事务)
    L1-058 6翻了 (15 分)
    L1-057 PTA使我精神焕发 (5 分)
    L1-056 猜数字 (20 分)
    L1-055 谁是赢家 (10 分)
    L1-054 福到了 (15 分)
    L1-053 电子汪 (10 分)
    L1-052 2018我们要赢 (5 分)
    L1-051 打折 (5 分)
    L1-050 倒数第N个字符串 (15 分)
  • 原文地址:https://www.cnblogs.com/dashucoding/p/11140366.html
Copyright © 2011-2022 走看看