Loading...
Loading...
Apply Google CSS style guide conventions to CSS code
npx skill4agent add the-perfect-developer/the-perfect-opencode css/* Not recommended: presentational */
.button-green {}
.clear {}
.yee-1901 {} /* meaningless */
/* Recommended: functional */
.gallery {}
.login {}
.video {}
.aux {} /* generic helper */
.alt {} /* generic alternative *//* Not recommended */
#example {}
#navigation {}
/* Recommended */
.example {}
.navigation {}/* Not recommended */
.navigation {}
.atr {}
/* Recommended */
.nav {}
.author {}/* Not recommended */
.demoimage {}
.error_status {}
/* Recommended */
.video-id {}
.ads-sample {}/* For namespacing in large projects */
.adw-help {} /* AdWords */
.maia-note {} /* Maia *//* Not recommended */
ul.example {}
div.error {}
/* Recommended */
.example {}
.error {}/* Not recommended */
border-top-style: none;
font-family: palatino, georgia, serif;
font-size: 100%;
line-height: 1.6;
padding-bottom: 2em;
padding-left: 1em;
padding-right: 1em;
padding-top: 0;
/* Recommended */
border-top: 0;
font: 100%/1.6 palatino, georgia, serif;
padding: 0 1em 2em;/* Not recommended */
margin: 0px;
padding: 0em;
/* Recommended */
margin: 0;
padding: 0;
/* Exception: required units */
flex: 0px; /* flex-basis requires unit */
flex: 1 1 0px; /* needed in IE11 *//* Not recommended */
font-size: .8em;
/* Recommended */
font-size: 0.8em;/* Not recommended */
color: #eebbcc;
/* Recommended */
color: #ebc;/* Not recommended */
color: #E5E5E5;
/* Recommended */
color: #e5e5e5;!important/* Not recommended */
.example {
font-weight: bold !important;
}
/* Recommended */
.example {
font-weight: bold;
}
/* If override needed, increase specificity */
.container .example {
font-weight: bold;
}/* Not recommended */
.example {
width: 100px\9; /* IE hack */
}
/* Recommended: Use feature queries */
@supports (display: grid) {
.example {
display: grid;
}
}.example {
color: blue;
}
@media screen, projection {
html {
background: #fff;
color: #444;
}
}/* Recommended */
background: fuchsia;
border: 1px solid;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
color: black;
text-align: center;
text-indent: 2em;/* Not recommended */
.test {
display: block;
height: 100px
}
/* Recommended */
.test {
display: block;
height: 100px;
}/* Not recommended */
h3 {
font-weight:bold;
}
/* Recommended */
h3 {
font-weight: bold;
}/* Not recommended: missing space */
.video{
margin-top: 1em;
}
/* Not recommended: unnecessary line break */
.video
{
margin-top: 1em;
}
/* Recommended */
.video {
margin-top: 1em;
}/* Not recommended */
a:focus, a:active {
position: relative; top: 1px;
}
/* Recommended */
h1,
h2,
h3 {
font-weight: normal;
line-height: 1.2;
}html {
background: #fff;
}
body {
margin: auto;
width: 50%;
}/* Not recommended */
@import url("https://www.google.com/css/maia.css");
html {
font-family: "open sans", arial, sans-serif;
}
/* Recommended */
@import url(https://www.google.com/css/maia.css);
html {
font-family: 'open sans', arial, sans-serif;
}
/* Exception: @charset requires double quotes */
@charset "utf-8";/* Recommended */
background: url(images/bg.png);/* Header */
.adw-header {}
.adw-header-logo {}
/* Footer */
.adw-footer {}
/* Gallery */
.adw-gallery {}
.adw-gallery-item {}/* Base styles */
html,
body {
margin: 0;
padding: 0;
}
/* Typography */
h1, h2, h3 {
font-family: 'Arial', sans-serif;
}
/* Layout */
.container {
max-width: 1200px;
margin: 0 auto;
}
/* Components */
.button {
padding: 10px 20px;
}
/* Utilities */
.hidden {
display: none;
}/* Not recommended: too specific */
html body div.container ul.nav li.item a.link {}
/* Recommended */
.nav-link {}/* Not recommended */
.header .nav .menu .item .link {
color: blue;
}
/* Recommended */
.nav-link {
color: blue;
}/* Base styles for mobile */
.container {
width: 100%;
}
/* Progressively enhance for larger screens */
@media (min-width: 768px) {
.container {
width: 750px;
}
}
@media (min-width: 1024px) {
.container {
width: 960px;
}
}/* Layout utilities */
.flex {
display: flex;
}
.flex-center {
display: flex;
justify-content: center;
align-items: center;
}
/* Spacing utilities */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }| Rule | Convention |
|---|---|
| Indentation | 2 spaces |
| Case | Lowercase |
| Quotes | Single ( |
| Semicolons | Required after every declaration |
| Units | Omit after |
| Leading zeros | Always include ( |
| Hex colors | 3-char when possible, lowercase |
| ID selectors | Avoid |
| Type selectors | Don't qualify classes |
| Avoid |
| Property order | Alphabetical (optional) |
| Line breaks | New line per selector/declaration |
| Rule separation | Blank line between rules |
| Comments | Section comments for organization |
.button {
background-color: #007bff;
border: 0;
border-radius: 4px;
color: #fff;
cursor: pointer;
display: inline-block;
font-size: 1rem;
padding: 0.5rem 1rem;
text-align: center;
text-decoration: none;
}
.button:hover {
background-color: #0056b3;
}
.button-secondary {
background-color: #6c757d;
}
.button-large {
font-size: 1.25rem;
padding: 0.75rem 1.5rem;
}.card {
background: #fff;
border: 1px solid #ddd;
border-radius: 8px;
padding: 1.5rem;
}
.card-header {
border-bottom: 1px solid #ddd;
margin-bottom: 1rem;
padding-bottom: 0.5rem;
}
.card-title {
font-size: 1.5rem;
margin: 0;
}
.card-body {
line-height: 1.6;
}.grid {
display: grid;
gap: 1rem;
grid-template-columns: repeat(12, 1fr);
}
.col-4 {
grid-column: span 4;
}
.col-6 {
grid-column: span 6;
}
.col-12 {
grid-column: span 12;
}references/css-detailed.md@charset