SlideShare a Scribd company logo
CSS in JS
Yukiya Nakagawa
JSON #9
2017.10.13(Fri) @Nkzn
Q. CSS in JS is
A. JS CSS
const coolFont = {
fontFamily: "CoolFont",
fontStyle: "normal",
fontWeight: "normal",
src: "url('coolfont.woff2') format('woff2')"
};
const styles = {
heading: {
color: 'gray',
fontSize: '2rem'
},
text: {
marginTop: '1rem',
margin: 10
}
};
React
const Hoge = (props) => {
return (
<div>
<h1 style={styles.heading}> </h1>
<p style={styles.text}> </p>
<p style={{ color: red }}>{props.hoge}</p>
</div>
);
}
JSON
※
CSS
CSS 7
https://speakerdeck.com/vjeux/react-css-in-js
7
1.
2.
3.
4. minify
5.
6.
7.
CSS in JS
React Native 😎
https://facebook.github.io/react-native/docs/height-and-width.html
StyleSheet.create
import { StyleSheet } from 'react-native';
const styles = StyleSheet.create({
bigblue: {
color: 'blue',
fontWeight: 'bold',
fontSize: 30,
},
red: {
color: 'red',
},
});
<span style={styles.red}>hoge</span>
Web
CSS
CSS in JSの話 #friday13json
https://github.com/Khan/aphrodite
import { StyleSheet } from 'aphrodite';
const styles = StyleSheet.create({
red: { backgroundColor: ‘red' },
blue: { backgroundColor: ‘blue’ },
hover: {
':hover': {
backgroundColor: 'red'
}
},
small: {
'@media (max-width: 600px)': {
backgroundColor: 'red',
}
}
});
}
RN
import { css } from 'aphrodite';
const App = (props) => {
return (
<div>
<span className={css(styles.red)}>This is red.</span>
<span className={css(styles.hover)}>This turns red on hover.</span>
<span className={css(styles.small)}>
This turns red when the browser is less than 600px width.
</span>
<span className={css(styles.red, styles.blue)}>This is blue.</span>
<span className={css(styles.blue, styles.small)}>
This is blue and turns red when the browser is less than
600px width.
</span>
</div>
);
}
CSS in JSの話 #friday13json
🤔
🤡
CSS in JSの話 #friday13json
CSS in JSの話 #friday13json
AB
※
CSS in JS 💪

More Related Content

PPT
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الثالث)
PPSX
Session three *JavaScript*
PDF
Milhagalveias
PDF
1 04-2014- gestão democrática
PPTX
Web Design Redux
PDF
Excel shortcut and function keys hindi notes
PDF
Microsoft access hindi notes
PDF
Rs cit important question
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الثالث)
Session three *JavaScript*
Milhagalveias
1 04-2014- gestão democrática
Web Design Redux
Excel shortcut and function keys hindi notes
Microsoft access hindi notes
Rs cit important question

What's hot (17)

PDF
Seminário Do Mab
PDF
Neoito — How modern browsers work
PPTX
SenchaCon 2016: JavaScript is Great but Stop Writing It - Rory Hardy
KEY
Onde mora a produtividade do Ruby on Rails?
TXT
Mi vida - Hefziba
PDF
How to make a spaghetti
PPTX
Slide (kannoor)
PPTX
PDF
Webové aplikace v JavaScriptu
PDF
E-Commerce in canada
TXT
El Codigo x jorge
PPTX
Shell Scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
PDF
Computer in hindi I
PPT
Slide (kannoor)
ODP
Shell Scripting & Ruby Hacking
PDF
Mowasalat Company profile
Seminário Do Mab
Neoito — How modern browsers work
SenchaCon 2016: JavaScript is Great but Stop Writing It - Rory Hardy
Onde mora a produtividade do Ruby on Rails?
Mi vida - Hefziba
How to make a spaghetti
Slide (kannoor)
Webové aplikace v JavaScriptu
E-Commerce in canada
El Codigo x jorge
Shell Scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
Computer in hindi I
Slide (kannoor)
Shell Scripting & Ruby Hacking
Mowasalat Company profile
Ad

Similar to CSS in JSの話 #friday13json (20)

PPTX
CSS-in-JS in React: Why, current state, and bright future.
PDF
Implementing CSS support for React Native
PDF
Caffeinated Style Sheets
PPTX
INTRODUCTIONS OF CSS
PPTX
Build a better UI component library with Styled System
PDF
Start your app the better way with Styled System
PDF
CSS-in-JS: unexpected lessons for Drupal component design
PDF
Css system
PDF
A journey from sass to css in-js
PDF
How to-inline-style-in-reactjs-
PDF
slides-students-C04.pdf
PPT
PHP - Introduction to PHP CSS
PDF
Will js kill css
PPT
CSS Training in Bangalore
PPTX
Writing Scalable and Maintainable CSS
PPTX
CSS in JS for CSS lovers
PPTX
Web - CSS 1.pptx
PPT
PPTX
Lecture 9 CSS part 1.pptxType Classification
PDF
CSS in React - Will Change Transform
CSS-in-JS in React: Why, current state, and bright future.
Implementing CSS support for React Native
Caffeinated Style Sheets
INTRODUCTIONS OF CSS
Build a better UI component library with Styled System
Start your app the better way with Styled System
CSS-in-JS: unexpected lessons for Drupal component design
Css system
A journey from sass to css in-js
How to-inline-style-in-reactjs-
slides-students-C04.pdf
PHP - Introduction to PHP CSS
Will js kill css
CSS Training in Bangalore
Writing Scalable and Maintainable CSS
CSS in JS for CSS lovers
Web - CSS 1.pptx
Lecture 9 CSS part 1.pptxType Classification
CSS in React - Will Change Transform
Ad

More from Yukiya Nakagawa (20)

PDF
Atomic Designは「マルチ」で真価を発揮する
PDF
Androidの入門書を書いたときに気にしたこと #NDS57
PDF
React Nativeの光と闇
PDF
アグリノートにおけるGIS情報を活かした圃場・作付管理の取り組み @ FOSS4GJ
PDF
React Native Androidはなぜ動くのか
PDF
React Nativeアプリをリリースし続けるために、最初に行う8つの取り組み
PDF
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
PDF
AndroidLint #DroidKaigi
PDF
Android Lintを覚えてベテラン開発者に追いつこう #ndsmeetup
PDF
僕らのデータ同期プラクティス
PDF
Android再入門 〜Eclipseのことは忘れろ〜
PDF
もう一度Kotlinの話をしよう #ndsmeetup4
PPTX
アグリノートを支える技術
PDF
NDS36 Kotlin Cute
PDF
NDS36 Java7&Java8
PPTX
Coworking Business Forum in NIIGATA 2013
PPTX
Niigata.rb#03
PPTX
PechaKucha Niigata #3 2013.7.27
PPTX
ぼくのかんがえたふつうのあんどろいどかいはつ
PPTX
Androidで使えるJSON-Javaライブラリ
Atomic Designは「マルチ」で真価を発揮する
Androidの入門書を書いたときに気にしたこと #NDS57
React Nativeの光と闇
アグリノートにおけるGIS情報を活かした圃場・作付管理の取り組み @ FOSS4GJ
React Native Androidはなぜ動くのか
React Nativeアプリをリリースし続けるために、最初に行う8つの取り組み
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
AndroidLint #DroidKaigi
Android Lintを覚えてベテラン開発者に追いつこう #ndsmeetup
僕らのデータ同期プラクティス
Android再入門 〜Eclipseのことは忘れろ〜
もう一度Kotlinの話をしよう #ndsmeetup4
アグリノートを支える技術
NDS36 Kotlin Cute
NDS36 Java7&Java8
Coworking Business Forum in NIIGATA 2013
Niigata.rb#03
PechaKucha Niigata #3 2013.7.27
ぼくのかんがえたふつうのあんどろいどかいはつ
Androidで使えるJSON-Javaライブラリ

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
cuic standard and advanced reporting.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Empathic Computing: Creating Shared Understanding
Advanced methodologies resolving dimensionality complications for autism neur...
20250228 LYD VKU AI Blended-Learning.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Unlocking AI with Model Context Protocol (MCP)
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
cuic standard and advanced reporting.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Machine learning based COVID-19 study performance prediction
Per capita expenditure prediction using model stacking based on satellite ima...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Understanding_Digital_Forensics_Presentation.pptx

CSS in JSの話 #friday13json