css Расширение/Наследованиев.scss

extend.scss
/* This CSS will print because %message-shared is extended. */
%message-shared {
  border: 1px solid #ccc;
  padding: 10px;
  color: #333;
}

// This CSS won't print because %equal-heights is never extended.
%equal-heights {
  display: flex;
  flex-wrap: wrap;
}

.message {
  @extend %message-shared;
}

.success {
  @extend %message-shared;
  border-color: green;
}

.error {
  @extend %message-shared;
  border-color: red;
}

.warning {
  @extend %message-shared;
  border-color: yellow;
}
Example.css
.message, .success, .error, .warning {
  border: 1px solid #ccc;
  padding: 10px;
  color: #333;
}

.success {
  border-color: green;
}

.error {
  border-color: red;
}

.warning {
  border-color: yellow;
}

css 修复DM问题1.20页脚bg

fix DM issue 1.20 footer bg
/* DM override */

#block-footer-motion,
#block-footer-motion .block__content,
#block-disclaimerblock,
#block-disclaimerblock .block__content {
  background: black!important;
}

#block-footer-motion .block__content p,
#block-footer-motion .block__content a,
#block-disclaimerblock .block__content p,
#block-disclaimerblock .block__content a,
[data-block-internal-id="footer_motion"] .company_profile__field--type-string-long {
  color: white!important;
}

/* WND DM override */

css 不透明的背景

opaqueBg
opaqueBg {
background: rgba(133,156,238,.15);
box-shadow: inset 0 0 8px 0 #11253e;
border: 1px solid #1b335b;
}

css 第23集React Scrimba

App.js
import React from "react";
import TodoItem from "./components/TodoItem";
import todosData from "./data/todosData";
import "./stylesheets/TodoItem.css"

function App() {
  const todoItems = todosData.map(item => (
    <TodoItem key={item.id} item={item} />
  ));

  return <div className="todo-list">{todoItems}</div>;
}

export default App;
TodoItem.js
import React from "react";

function TodoItem(props) {
  return (
    <div className="todo-item">
      <input type="checkbox" checked={props.item.completed} />
      <p>{props.item.text}</p>
    </div>
  );
}

export default TodoItem;
TodoItem.css
body {
  background-color: whitesmoke;
}

.todo-list {
  background-color: white;
  margin: auto;
  width: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid #efefef;
  box-shadow:
    /* The top layer shadow */ 0 1px 1px rgba(0, 0, 0, 0.15),
    /* The second layer */ 0 10px 0 -5px #eee,
    /* The second layer shadow */ 0 10px 1px -4px rgba(0, 0, 0, 0.15),
    /* The third layer */ 0 20px 0 -10px #eee,
    /* The third layer shadow */ 0 20px 1px -9px rgba(0, 0, 0, 0.15);
  padding: 30px;
}

.todo-item {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 30px 20px 0;
  width: 70%;
  border-bottom: 1px solid #cecece;
  font-family: Roboto, sans-serif;
  font-weight: 100;
  font-size: 15px;
  color: #333333;
}

input[type="checkbox"] {
  margin-right: 10px;
  font-size: 30px;
}

input[type="checkbox"]:focus {
  outline: 0;
}

css 响应表

responsive_table.js
$('table').each(function () {
      let This = $(this);
      let lista = [];

      This.find('th').each(function (index) {
        console.log(index);
        let Th = $(this);
        let text = Th.text();
        lista.push(text);
      });

      This.find('tr').each(function () {
        $(this).find('td').each(function (index) {
          $(this).attr('data-label', lista[index]);
        });
      });

    });
table.css
@media screen and (max-width: 600px) {

  table caption {
    font-size: 1.5em;
    margin: .5em 0 .75em;
  }

  table tr {
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    padding: .39em;
  }

  table th,
  table td {
    padding: .625em;
    text-align: center;
  }

  table th {
    font-size: .85em;
    letter-spacing: .1em;
    text-transform: uppercase;
  }


  table {
    border: 0;

    caption {
      font-size: 1.3em;
    }

    thead {
      border: none;
      clip: rect(0 0 0 0);
      height: 1px;
      margin: -1px;
      overflow: hidden;
      padding: 0;
      position: absolute;
      width: 1px;
    }

    tr {
      border-bottom: 3px solid #ddd;
      display: block;
      margin-bottom: .625em;
    }

    td {
      border-bottom: 1px solid #ddd;
      display: block;
      font-size: .8em;
      text-align: right;
    }

    td::before {

      /*
      * aria-label has no advantage, it won't be read inside a table
      content: attr(aria-label);
      */
      content: attr(data-label);
      float: left;
      font-weight: bold;
      text-transform: uppercase;
    }
  }

  table td:last-child {
    border-bottom: 0;
  }
}

css 重置CSS

重置CSS

RESET.css
/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}

css Bouton动画盘旋2

html
<a class="btn">
      <span class="text">Voir mes projets</span>
      <span class="line -right"></span>
      <span class="line -top"></span>
      <span class="line -left"></span>
      <span class="line -bottom"></span>
</a>
css
.btn {
    color: black;
    padding: 0.7em calc(0.7em * 1.2);
    display: inline-block;
    border: 3px solid transparent;
    position: relative;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 20px;
}

.btn .text {
    font-family: 'Yanone Kaffeesatz', sans-serif;
    transform: translate3d(0, 0.7em, 0);
    display: block;
    transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1) 0.4s;
}
.btn:after {
    position: absolute;
    content: '';
    bottom: -3px;
    left: calc(0.7em * 1.2);
    right: calc(0.7em * 1.2);
    height: 3px;
    background: #ff8500;
    transition: transform 0.8s cubic-bezier(1, 0, 0.37, 1) 0.2s, right 0.2s cubic-bezier(0.04, 0.48, 0, 1) 0.6s, left 0.4s cubic-bezier(0.04, 0.48, 0, 1) 0.6s;
    transform-origin: left;
}
.btn .line {
    position: absolute;
    background: #ff8500;
}
.btn .line.-right, .btn .line.-left {
    width: 3px;
    bottom: -3px;
    top: -3px;
    transform: scale3d(1, 0, 1);
}
.btn .line.-top, .btn .line.-bottom {
    height: 3px;
    left: -3px;
    right: -3px;
    transform: scale3d(0, 1, 1);
}
.btn .line.-right {
    right: -3px;
    transition: transform 0.1s cubic-bezier(1, 0, 0.65, 1.01) 0.23s;
    transform-origin: top;
}
.btn .line.-top {
    top: -3px;
    transition: transform 0.08s linear 0.43s;
    transform-origin: left;
}
.btn .line.-left {
    left: -3px;
    transition: transform 0.08s linear 0.51s;
    transform-origin: bottom;
}
.btn .line.-bottom {
    bottom: -3px;
    transition: transform 0.3s cubic-bezier(1, 0, 0.65, 1.01);
    transform-origin: right;
}
.btn:hover .text,
.btn:active .text {
    transform: translate3d(0, 0, 0);
    transition: transform 0.6s cubic-bezier(0.2, 0, 0, 1) 0.4s;
}
.btn:hover:after,
.btn:active:after {
    transform: scale3d(0, 1, 1);
    right: -3px;
    left: -3px;
    transform-origin: right;
    transition: transform 0.2s cubic-bezier(1, 0, 0.65, 1.01) 0.17s, right 0.2s cubic-bezier(1, 0, 0.65, 1.01), left 0s 0.3s;
}
.btn:hover .line,
.btn:active .line {
    transform: scale3d(1, 1, 1);
}
.btn:hover .line.-right,
.btn:active .line.-right {
    transition: transform 0.1s cubic-bezier(1, 0, 0.65, 1.01) 0.2s;
    transform-origin: bottom;
}
.btn:hover .line.-top,
.btn:active .line.-top {
    transition: transform 0.08s linear 0.4s;
    transform-origin: right;
}
.btn:hover .line.-left,
.btn:active .line.-left {
    transition: transform 0.08s linear 0.48s;
    transform-origin: top;
}
.btn:hover .line.-bottom,
.btn:active .line.-bottom {
    transition: transform 0.5s cubic-bezier(0, 0.53, 0.29, 1) 0.56s;
    transform-origin: left;
}

css 光滑的圆点和箭头样式

Design de base pour les dots et arrows de Slick

style.css
.slick-dots button {
   background: none;
   border: 2px solid #662136;
   width: 12px;
   height: 12px;
   display: block;
   border-radius: 50%;
   font-size: 0;
   color: transparent;
}

.slick-dots {
   list-style: none;
   display: flex;
   justify-content: center;
   padding: 0;
}

.slick-dots li {
   margin: 5px;
}

.slick-active button {
   background: #662136;
}

.slick-prev, .slick-next {
   position: absolute;
   width: 20px;
   height: 20px;
   left: 0;
   bottom: 0;
   cursor: pointer;
   background-image: url(img/arrow-left.png);
   background-repeat: no-repeat;
   background-size: contain;
   z-index: 1;
   border: solid 2px #55b556;
   padding: 10px;
   background-position: center;
   font-size: 0;
   color: transparent;
}
 
.slick-next {
   right: 0;
   left: auto;
   background-image: url(img/arrow-right.png);
}

css 现代CSS

modern
/*=====================
GENERAL
======================*/

/* fix align classes not working on embedded entities */
.text-align-right {
  text-align: right !important;
}

.text-align-left {
  text-align: left !important;
}

#main .align-center,
.orbit__container .align-center {
  text-align: center;
  margin: 0 auto;
}

/* add white space before footer on inside pages*/
.not-front .footer {
  margin-top: 5rem;
}

/* map */
.iframeWrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
}

.iframeWrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/*======================
BUTTONS
======================*/

/* ADD ARROWS TO BLOCK TITLES and BUTTONS */
/* Optional - Remove if don't like the look */
h3.node__title a {
  position: relative;
}

.team-member h3.node__title a::after,
.products-services h3.node__title a::after,
.blog h3.node__title a::after {
  content: "›";
  font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  display: inline-block;
  position: absolute;
  bottom: -3px;
  right: -20px;
  transition: all 0.3s ease;
}

.team-member h3.node__title a:hover::after,
.products-services h3 a:hover::after,
.blog h3.node__title a:hover::after  {
 right: -30px;
}

/* ADD ARROWS TO BUTTONS */
/* Optional */
#edit-submit::after,
.button::after,
.node--read-mode::after,
.button-primary::after {
  content: "›";
  font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
  display: inline-block;
  padding-left: 20px;
  transition: all 0.3s ease;
  position: relative;
  top: -1px;
}

#edit-submit:hover::after,
.button:hover::after,
.node--read-mode:hover::after,
.button-primary:hover::after  {
  padding-left: 30px;
}

/*======================
HEADER
=======================*/

 
/* header within */
.aw-header .header_within {
  max-width: 99%;
} 

.aw-header .header_within > .grid-container {
  max-width: 100%;
}

/* logo */
.path-frontpage .block--logo .image__field--type-image img {
  visibility: hidden;
  max-height: 25px
}

@media screen and (min-width: 40em){
  .block--logo .image__field--type-image img {
    max-height: 100px;
  }
}

.block--logo .image__field--type-image img {
  padding: 0;
}

/*======================
NAVIGATION
=======================*/
.aw-header .navbar-menu-block {
  margin-top: 10px;
}

.menu-icon::after {
  background: white;
  box-shadow: 0 7px 0 white,0 14px 0 white;
}

/*navigation*/
[data-block-internal-id="aw_core_visitormainmenu"] .dropdown.menu .is-active > a {
  color: white;
}

/* submenu */
[data-block-internal-id="aw_core_visitormainmenu"] .is-dropdown-submenu {
  background-color: rgba(0,0,0,0.5)!important;
  border: none !important;
}

[data-block-internal-id="aw_core_visitormainmenu"] .menu-item.is-dropdown-submenu-item > a {
  color: white;
}

/*======================
BANNERS
=======================*/

/*overlay tint for frontpage banner*/
.path-frontpage .orbit__container .orbit__image:after {
  content: "";
  display: block;
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(0,0,0,0.4);
  /* REMOVE ANIMATION IF USING MULTIPLE SLIDER IMAGES*/
  animation: brighten 1s ease;
}

/* REMOVE ANIMATION IF USING MULTIPLE SLIDER IMAGES*/
@keyframes brighten {
  from {background: rgba(0,0,0,1);}
  to {background: rgba(0,0,0,0.4);}
}

@media print, screen and (min-width: 64em){
  [data-block-internal-id="core_slider_fullscreen"] .fullscreen-image-slider .orbit__caption {
    width: 80%;
  }
}

.path-frontpage [data-block-internal-id="core_slider_fullscreen"] .orbit__caption > h1 {
  margin-top: 0.5rem;
  margin-bottom: 3.5rem;
}

/*fade in landing page captions*/
[data-block-internal-id="core_slider_fullscreen"] .fullscreen-image-slider .orbit__caption {
  animation: fadeIn 1.5s ease;
}

/* animate landingpage caption and logo */
#block-core-slider-regular,
[data-block-internal-id="core_slider_fullscreen"] .fullscreen-image-slider article,
[data-block-internal-id="core_slider_fullscreen"] .fullscreen-image-slider h1 {
 animation: slideDown 1.5s ease; 
 position: relative;
}

main,
.footer,
[data-block-internal-id="core_slider_fullscreen"] .fullscreen-image-slider .orbit__caption h4 {
  position: relative;
  animation: slideUp 1.5s ease;
}

/* IMPORTANT - Use JS to prepend the logo to h1 */
.path-frontpage [data-block-internal-id="core_slider_fullscreen"] .orbit__caption > h1 img {
  max-width: 450px;
  margin-bottom: 1rem;
}

@media screen and (max-width:500px){
  .path-frontpage [data-block-internal-id="core_slider_fullscreen"] .orbit__caption > h1 img {
    max-width: 90%;
  }
}

/* banner buttons styles */
[data-block-internal-id="core_slider_fullscreen"] a.button:last-child {
  background-color: rgba(255,255,255,0.8);
  border: 2px solid rgba(255,255,255,0.8);
  color: #2b2b2b;
}

[data-block-internal-id="core_slider_fullscreen"] a.button:last-child:hover {
  background-color: white;
  border: 2px solid white
}

.not-front .layout-container {
  animation: fadeIn 2s ease;
}

@keyframes fadeIn {
  from {opacity: 0;}
  to {opacity: 1;}
}

@keyframes slideDown {
  from {top: -30px;}
  to {top: 0;}
}

@keyframes slideUp {
  from {bottom: -30px;}
  to {bottom: 0;}
}

/*overlay tint for internal banner*/
.not-front .view-mode-slider:after {
  content: "";
  display: block;
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(0,0,0,0.3);
}

@media print, screen and (min-width: 40em){
  [data-block-internal-id="core_slider_regular"] .page-top__static-caption {
    margin-top: 30px;
  }
}

/*======================
INTERNAL PAGES
=======================*/

/* PAGE - BLOG */
/* fix huge featured image*/
@media screen and (min-width: 700px){
  .blog--full .field--name-field-featured-image .field--type-image {
    max-width: 400px;
    float: right;
    display: block;
  }
}

/* PAGE - CONTACT */
[data-block-internal-id="sitewidecontactform_5"] .text-center {
  text-align: left;
  margin-bottom: 10px;
}

@media screen and (min-width: 40em){
  #block-sitewidecontactform {
    margin-left: 50px;
  }
}

@media screen and (max-width: 40em){
  #block-sitewidecontactform {
    margin-top: 50px;
  }

  #block-sitewidecontactform h2 {
    font-size: 24px;
  }
}

/* FORMS */
input:not([type]), input[type=text], input[type=password], input[type=date], input[type=datetime], input[type=datetime-local], input[type=month], input[type=week], input[type=email], input[type=number], input[type=search], input[type=tel], input[type=time], input[type=url], input[type=color], textarea, fieldset {
  border-radius: 5px !important;
  box-shadow: none !important;
  padding: 1.5rem 1rem !important;
  border: 1px solid #ccc;
}

input:not([type]):focus, input[type=text]:focus, input[type=password]:focus, input[type=date]:focus, input[type=datetime]:focus, input[type=datetime-local]:focus, input[type=month]:focus, input[type=week]:focus, input[type=email]:focus, input[type=number]:focus, input[type=search]:focus, input[type=tel]:focus, input[type=time]:focus, input[type=url]:focus, input[type=color]:focus, textarea:focus {
  border: 1px solid #2d2d2d;
}

/*=======================
FOOTER
========================*/
.footer .social-media-icon {
  font-size: 2rem;
}

/* FOOTER CTA */

[data-block-internal-id="cta"] .block--custom__row {
  padding-bottom: 0;
}

#block-footer .contact-info-container,
#block-footer .social-media-container {
  text-align: center;
}

#block-footer .contact-info-container {
  line-height: 1.6;
}

.path-frontpage .bottom-bar {
  position: fixed;
  width: 100%;
  bottom: 0;
  left: 0;
  background-color: rgba(0,0,0,0.75);
}

/*=======================
BUG FIXES
========================*/

/* Blog tag page fixes */
body.path-taxonomy {
  color: white;
}
 
.path-taxonomy [data-block-internal-id="core_slider_regular"] .page-top-image-slider {
  margin-top: -28px;
}
 
/*Fix layout on category when multiple blogs exist*/
 
.path-taxonomy #block-mainpagecontent .grid-x.medium-unstack {
  flex-direction: column !important;
}
 
.path-taxonomy #block-mainpagecontent .grid-x > .blog {
  width: 90% !important;
  margin-bottom: 1rem;
}
 
@media screen and (max-width: 48em){
  .path-taxonomy #block-mainpagecontent .grid-x > .blog .main-section {
    padding-left: 0;
  }
}

css 第19集React Scrimba

App.js
import React from "react";
import ContactCard from "./ContactCard";

function App() {
  return (
    <div className="contacts">
      <ContactCard
        contact={{
          name: "Mr. Whiskerson",
          imgUrl: "http://placekitten.com/300/200",
          phone: "(212) 555-1234",
          email: "mr.whiskaz@catnap.meow"
        }}
      />
      <ContactCard
        contact={{
          name: "Fluffykins",
          imgUrl: "http://placekitten.com/400/200",
          phone: "(212) 555-2345",
          email: "fluff@me.com"
        }}
      />
      <ContactCard
        contact={{
          name: "Destroyer",
          imgUrl: "http://placekitten.com/400/300",
          phone: "(212) 555-3456",
          email: "ofworlds@yahoo.com"
        }}
      />
      <ContactCard
        contact={{
          name: "Felix",
          imgUrl: "http://placekitten.com/200/100",
          phone: "(212) 555-4567",
          email: "thecat@hotmail.com"
        }}
      />
    </div>
  );
}

export default App;
ContactCard.js
import React from "react";

function ContactCard(props) {
  console.log(props);
  return (
    <div className="contact-card">
      <img src={props.contact.imgUrl} />
      <h3>{props.contact.name}</h3>
      <p>Phone: {props.contact.phone}</p>
      <p>Email: {props.contact.email}</p>
    </div>
  );
}

export default ContactCard;
ContactCard.css
body {
  margin: 0;
}

.contacts {
  display: flex;
  flex-wrap: wrap;
}

.contact-card {
  flex-basis: 250px;
  margin: 20px;
}

.contact-card > img {
  width: 100%;
  height: auto;
}

.contact-card > h3 {
  text-align: center;
}

.contact-card > p {
  font-size: 12px;
}