[CSS] #3. 배경 꾸미기

Jihye·2024년 1월 3일
0

CSS

목록 보기
3/6
post-thumbnail

그라데이션


[그라데이션 넣기]
https://velog.io/@hoje15v/CSSposition-%EC%86%8D%EC%84%B1-relative-absolute-fixed%EC%97%90-%EB%8C%80%ED%95%B4-%EC%95%8C%EC%95%84%EB%B3%B4%EC%9E%90

/* A gradient tilted 45 degrees,
   starting blue and finishing red */
linear-gradient(45deg, blue, red)

/* A gradient going from the bottom right to the top left corner,
   starting blue and finishing red */
linear-gradient(to left top, blue, red)

/* Interpolation in rectangular color space */
linear-gradient(in oklab, blue, red)

/* Interpolation in polar color space */
linear-gradient(in hsl, blue, red)

/* Interpolation in polar color space
  with longer hue interpolation method */
linear-gradient(in hsl longer hue, blue, red)

/* Color stop: A gradient going from the bottom to top,
   starting blue, turning green at 40% of its length,
   and finishing red */
linear-gradient(0deg, blue, green 40%, red)

/* Color hint: A gradient going from the left to right,
   starting red, getting to the midpoint color
   10% of the way across the length of the gradient,
   taking the rest of the 90% of the length to change to blue */
linear-gradient(.25turn, red, 10%, blue)

/* Multi-position color stop: A gradient tilted 45 degrees,
   with a red bottom-left half and a blue top-right half,
   with a hard line where the gradient changes from red to blue */
linear-gradient(45deg, red 0 50%, blue 50% 100%)

색, 색의 개수, 비중, 각도 등을 조정하여 그라데션을 만들 수 있다.
태그, 클래스 등 안에

background : linear-gradient (색상)

background-image

background image : url("")
이미지가 다운로드 되어 있다면 html, 브라우저 주소/폴더명(이럴 경우에는css가 작성되고 있는 폴더 안에 넣어준다.) ""따옴표 안에 넣어준다.

  • 이미지가 정해진 영역에 알아서 반복된다.
  • 반복을 원하지 않는 경우에는 background-repeat : no-repeat
  • 이미지의 위치를 특정 위치에 놓는 경우에는 background-position : 에 top, bottom, left, right, center 등 방향으로 지정
  • 배경 이미지의 크기를 지정하기 위해서는
    background-size
    -auto : 이미지의 실제 크기
    - 단위 : px, em, rem 등 단위로 지정
    - cover : 전부 덮게
    - contain : 가로 세로 중 짧은 길이에 맞춰서 크기 조절
  • background attachment 로 배경이미지 스크롤 지정
  • 만약, 이미지의 크기가 들어가는 자리에 비해 너무 크다면
    background-positionbackground-size로 이미지의 보여주고 싶은 부분과 크기를 조절해서 넣는다.

0개의 댓글