Advertisement
noblestremark11

CSS Note

Jan 19th, 2024 (edited)
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. LINKING HTML TO CSS
  2. <head>
  3. <link rel="stylesheet" href="style.css">
  4. </head>
  5.  
  6.  
  7.  
  8. body {
  9. background-color: azure;
  10. color: white;
  11. }
  12.  
  13. h1 {
  14. font-family: Helvetica;
  15. color: white;
  16. text-align: center;
  17. }
  18.  
  19. .className {
  20. border: solid 10px red;
  21. border-radius: 10px
  22. }
  23.  
  24. p {
  25. border-radius: 10px;
  26. background-color: lightBlue;
  27. border: solid;
  28. }
  29.  
  30. border is a property that adds border to an element
  31.  
  32. border-radius is a property that rounds the corners of an element. If we set the radius to 10px, the border curves 10px before the corner.
  33.  
  34. To make an image a circle, we set border-radius to half the width of an image. It only works if the image is a square though!
  35.  
  36. img {
  37. height: 100px;
  38. width: 100px;
  39. border-radius:
  40. 50px
  41. ;
  42. border: solid 5px;
  43. }
  44.  
  45. Q&A
  46. What forms a rule?
  47. A selector and its properties perform a CSS rule.
  48. 2) Any element has four paddings counted clockwise from top to right, to bottom, to left.
  49.  
  50. padding-top:
  51. 20px
  52. ;
  53. padding-right:
  54. 20px
  55. ;
  56. padding-bottom:
  57. 20px
  58. ;
  59. padding-left:
  60. 20px
  61. ;
  62.  
  63. We can set each padding value in one line using the padding property and a pixel value for each side.
  64.  
  65. padding: 10px 10px 10px 10px;
  66.  
  67. To add padding to the bottom, set the third value to 100px
  68.  
  69. 3) Shorthands work with the margin and border-radius properties, making it possible to create interesting styles with fewer lines of code.
  70.  
  71. button {
  72.  
  73. margin: 0 15px 0 15px;
  74. width: 100px;
  75. height: 100px;
  76. border-radius: 15px;
  77. background-color: red;
  78. border: solid 5px dimGray;
  79. }
  80.  
  81. To take border-radius to the extreme, we can set a corner to the same value as the height or width, like 100px in this case.
  82.  
  83. border-radius: 0 0 0
  84. 100px
  85. ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement