CSS - Background properties

0 votes
730 views
added Jul 18, 2018 in CSS by LC Marshal Captain (25,790 points)
  1. /*transparent #000 in rgba*/
  2. .background {
  3. background: rgba(0, 0, 0, 0);
  4. }
  5. /*bg fr body */
  6. background-image: url("../images/e7b335f7-pexels-photo-122244-large.jpeg");
  7. background-repeat: no-repeat;
  8. /*background-position: right top;*/
  9. background-attachment: fixed;
  10. /*gradient position*/
  11. background: linear-gradient(45deg, red, blue);
  12. background: linear-gradient(135deg, orange, orange 60%, cyan);
  13. /*Learn more here: https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient*/
  14. /*100% width and height minus specific size*/
  15. min-height: calc(100vh - 64px);
  16. max-height: calc(100vh - 64px);
  17. /*Background-cover*/
  18. .background-cover{
  19. backgrobund: url('https://s-media-cache-ak0.pinimg.com/736x/71/ca/46/71ca46ee76ba28ec1898d22db930d066--pink-houses-dream-houses.jpg') no-repeat fixed;
  20. -webkit-background-size: cover;
  21. -moz-background-size: cover;
  22. -o-background-size: cover;
  23. background-size: cover;
  24. }
  25. /*shadow style*/
  26. input[type=text] {
  27. &:focus {
  28. box-shadow: 0 0 10px #ffac32;
  29. }
  30. }
  31. /*faded black from bottom to top*/
  32. background-color: rgba(0,0,0,0.16);
  33. background-image: -moz-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.4));
  34. background-image: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(0,0,0,0)), to(rgba(0,0,0,0.4)));
  35. background-image: -webkit-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.4));
  36. background-image: -o-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.4));
  37. background-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.4));
  38. background-repeat: repeat-x;
  39. filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#66000000', GradientType=0);
  40. background-color: transparent;

 

3 Responses

0 votes
responded Jul 18, 2018 by LC Marshal Captain (25,790 points)
  1. /*If you do not need to add a border on columns, you can also simply add a transparent border on them*/
  2. [class*="col-"] {
  3. background-clip: padding-box;
  4. border: 10px solid transparent;
  5. }
  6.  
  7. /*To force the child element to follow the parent container*/
  8. box-sizing: border-box;

 

0 votes
responded Aug 24, 2018 by LC Marshal Captain (25,790 points)
  1. // to add filter on top of background image
  2. box-shadow: inset 0 0 0 1000px rgba(0, 0, 0, 0.59);
  3. background: url("http://site.com/images/buy_bg.jpg") no-repeat center;

 

0 votes
responded Oct 16, 2018 by LC Marshal Captain (25,790 points)

Background cover 

  1. background: url($assets-folk-pattern-png) no-repeat center;
  2. background-size: cover;

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...