小编baz*_*ush的帖子

使用CSS定位一组元素类型中的最后一个元素

我试过这个;

@mixin text-format{
>p, >ul, >h1, >h2, >h3, >h4, >h5{
    &:last-of-type{
        background-color:green;
    }
}
}

.text-body{
@include text-format;
}
Run Code Online (Sandbox Code Playgroud)

纯CSS

.text-body > p:last-of-type, .text-body > ul:last-of-type, .text-body > h1:last-of-type, .text-body > h2:last-of-type, .text-body > h3:last-of-type, .text-body > h4:last-of-type, .text-body > h5:last-of-type {
  background-color: green;
}
Run Code Online (Sandbox Code Playgroud)

这将选择每个元素类型的最后一个实例,但不包括该元素类型.我只想选择div中的最后一个元素,无论它是什么,但是在选择器中指定的元素类型中.

小提琴; http://jsfiddle.net/bazzle/bcLt62jx/

html css css-selectors pseudo-class css3

5
推荐指数
2
解决办法
881
查看次数

输入按钮无法解开文本

http://stepladderuk.com/dev/wedding/exp/

输入按钮中的文本是粗体,我不想要.

我无法弄清楚是什么让它变得大胆.

当我检查元素时,我想出了我在CSS中声明的font-weight:100.

我试过-webkit-appearance:none;

这会产生一种奇怪的行为,当你悬停时,文本只能解开.

HTML

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    <head>

        <!-- meta stuff -->
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Matt &amp; Caroline</title>
        <meta name="description" content="Description here">
        <meta http-equiv="cleartype" content="on">

        <!--FONT LINKAGE -->
        <link type="text/css" rel="stylesheet" href="http://fast.fonts.net/cssapi/c020518f-a748-4829-83c4-9cd0e83dd476.css"/>

        <!-- Stylesheet -->
        <link rel="stylesheet" href="css/main.css">

        <!-- Scripts -->
        <script src="js/modernizr-2.6.2.min.js"></script>

        <script …
Run Code Online (Sandbox Code Playgroud)

css forms input

0
推荐指数
1
解决办法
1324
查看次数

jQuery根据变量的条件行事

请看我的小提琴;

http://jsfiddle.net/bazzle/rtrz86oe/7/

var opened = false;
Run Code Online (Sandbox Code Playgroud)

单击该按钮时,该变量应更新为true.这意味着第一个条件是有效的;

if (opened == false){
    $('.btn').on('click',function(){
        opened = true;
    });
};
Run Code Online (Sandbox Code Playgroud)

太棒了,但是当你再次点击它时,变量应该更新为false.由于变量当前为"true",因此应使用此函数将其更改为false.但事实并非如此.

if (opened == true){

    $('.btn').on('click',function(){
        opened = false;
    });
};
Run Code Online (Sandbox Code Playgroud)

似乎第二个条件函数由于某种原因没有运行.

谢谢

javascript jquery

-1
推荐指数
1
解决办法
45
查看次数

标签 统计

css ×2

css-selectors ×1

css3 ×1

forms ×1

html ×1

input ×1

javascript ×1

jquery ×1

pseudo-class ×1