css常用属性

2019-03-01 22:38|来源: 网路

CSS的基本语法
   选择器 {
       属性键:属性值;
       属性键:属性值1 属性值2 ....;
   }
   注释:与java中多行注释相同
       /* 注释内容 */


CSS的常用属性

   单位:(了解)
       颜色单位 Color Units
           #RRGGBB    rgb ( R,G,B )    Color Name
       长度单位 Length Units
           em    ex    px像素(常用)    pt    pc    in    cm    mm
       单位换算:1in = 2.54cm = 25.4 mm = 72pt = 6pc
   属性:
       color ==> 文字颜色
       font-family ==> 文字样式
       font-size ==> 文字大小
       font-style => 文字样式(斜体..)
       font-weight => 文字加粗
       font-variant => 异性字


字体示例:


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
    p {
    /*
        font-size: 100px;
        font-family: 黑体;
        font-style: italic;
        font-weight: 900;
        font-variant: small-caps;
    */
    font :italic small-caps 900 100px 黑体;
    }
</style>
</head>
<body>
    <p>css字体示例</p>
</body>
</html>


css中背景属性示例:


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<style type="text/css">
    body {
    /*
        background-color: pink;
        background-image: url("001.jpg");
        background-repeat: no-repeat;
        background-attachment: fixed;
        */
        background : green url("001.jpg") no-repeat fixed center; 
    }
</style>
</head>
<body>
    <p>css中背景属性示例</p>
    <p>css中背景属性示例</p>
    <p>css中背景属性示例</p>
    ....................
</body>
</html>


整理于网络


相关问答

更多
  • 属性: 获得标签:$("#id") 获得标签内的代码:.html() 获得标签内的文本:.text() 修改标签内的代码:.html("内容"); 修改标签内的文本:.html("内容"); 获得标签属性:.attr("属性"); 修改标签属性:attr("属性","属性值"); 添加样式:addClass("样式名"); 动态切换样式:toggleClass("样式名"); 获取样式:css 添加元素:append("元素"); 移去元素:.remove(); 清空节点: .empty(); 获取第二个l ...
  • $("#test").css({"padding-top":"-100px"}); 这个写法是错误的,要报错的。看来楼上的对JS的命名规则还没有弄清楚呀。 jQuery的变量名里面是不允许用“-”的。上面的应该改成: $("#test").css({"paddingTop":"-100px"});
  • jquery设置CSS属性[2022-10-08]

    //jquery 不支持这种写法background-color改成:backgroundColor //$()里的选择器是要加上引号的 //例子: $("#id").css("backgroundColor","none")
  • 1.以下6个属性设置在容器上 flex-direction row/row-reverse/column/column-reverse 决定主轴的方向(即项目的排列方向) flex-wrap wrap/nowrap/wrap-reverse 决定项目排列方式 flex-flow | 前两者简写形式,默认flex-flow:row nowrap justify-content flex-start/flex-end/center/space-between/space-around 决定项目在主轴的对齐方式 ...
  • 如果你的按钮是用背景色来实现的还比较好判断 $().css('background-color') 这样可以取得背景色,剩下的逻辑你自己来
  • 您必须将每个单独的属性重新设置为其默认值。 这不是很好,但这是唯一的方式,给你的信息给我们。 在你的例子中,你会做: .c1 { height: auto; } 您应该在这里搜索每个属性: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference 例如, height : 初始值: auto 另一个例子, max-height : 初始值: none 在2017年,现在还有另一种方式,未设定的关键字: .c1 { height: ...
  • 虽然属性在某些情况下(*)确实有默认值,但它通常不会那样工作。 规范的作用是提供初始值,这些值通常在规范中提到。 color是少数例外情况之一,默认值是用户首选项的值(在Firefox中,编辑 - >首选项 - >内容 - >颜色 - >文本)。 大多数其他人确实有明确定义的初始值,例如对于border-style它none 。 这是官方的W3C文档,这是标准: http : //www.w3.org/TR/CSS21/ 要绝对清楚,属性必须根据规则具有值。 没有值的属性是错误,将被忽略。 (*)示例:在b ...
  • 如果元素具有ID,例如容器,则使用: var container_style = $('container').getStyle('background'); $$通常用于元素数组,例如具有相同类名的多个元素。 If the element has an ID, e.g. container, then use: var container_style = $('container').getStyle('background'); $$ is generally used for an array o ...
  • 我不确定,但也许你谈mix-blend-mode: difference ? I'm not sure, but maybe you talk about mix-blend-mode: difference?
  • Css属性都可以使用, 但是你不能使用伪类和伪元素,如:hover , :after :nth-child()等。 Css properties can all be used, but you cannot use pseudoclasses and pseudoelements like :hover, :after :nth-child() etc.