Last active
December 13, 2024 12:36
-
-
Save Shakil-Shahadat/24ed61346f763026c174 to your computer and use it in GitHub Desktop.
★ Some Common CSS Styles I Regularly Use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body | |
{ | |
font-family: 'Segoe UI', Verdana, Arial, Helvetica, sans-serif; | |
background-color: whitesmoke; | |
line-height: 26px; | |
} | |
.container | |
{ | |
background: white; | |
border: 1px solid silver; | |
padding: 50px; | |
box-shadow: 0 4px 8px 0 rgba( 0, 0, 0, 0.2 ), 0 6px 20px 0 rgba( 0, 0, 0, 0.19 ); | |
margin-top: 20px; | |
/* Horizontal centering */ | |
width: 960px; | |
margin: auto; | |
} | |
/* | |
Multi-column layout | |
*/ | |
div | |
{ | |
column-count: 3; | |
column-gap: 180px; | |
column-rule: 1px dotted; | |
} | |
/* | |
Removing underline from anchor tags | |
*/ | |
a | |
{ | |
text-decoration: none; | |
color: #0033FF; | |
} | |
a:visited | |
{ | |
color : #00CCCC; | |
} | |
a:hover | |
{ | |
color: Magenta; | |
text-decoration: underline; | |
} | |
/* | |
Textarea, Input styling | |
*/ | |
textarea, input | |
{ | |
border: 1px solid #d9d9d9; | |
font-size: 22px; | |
padding: 9px; | |
} | |
textarea:focus, input:focus | |
{ | |
border-color: rgba( 82, 168, 236, 0.8 ); | |
box-shadow: 0 0 6px rgba( 102, 175, 233, .6 ); | |
outline: 0; | |
} | |
/* | |
Table Styles | |
*/ | |
table | |
{ | |
border-collapse: collapse; | |
} | |
th, td | |
{ | |
border: 1px solid lightgray; | |
padding: 10px; | |
text-align: center; | |
} | |
/* | |
Zebra Striping Tables | |
*/ | |
tr:nth-child( odd ) | |
{ | |
background-color: #f2f2f2; | |
} | |
/* | |
Centering a floating item | |
*/ | |
.box | |
{ | |
position: sticky; | |
bottom: 20px; | |
width: 600px; | |
margin: auto; | |
} | |
/* | |
Types of CSS Positioning | |
Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/position | |
*/ | |
.box | |
{ | |
position: static; | |
position: absolute; | |
position: fixed; | |
position: relative; | |
position: sticky; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment