CSS 요소의 첫 번째 인스턴스를 올바르게 정렬 할 수 없습니다.

이안

CSS를 사용하여 타임 라인 유형 페이지를 설정하려고하는데 첫 번째 항목의 위치를 ​​설정하는 데 문제가 있습니다. 여기에서 스크린 샷을 참조하십시오.

중앙에서 벗어난 CSS 요소

나는 CSS 시트를 설정하는 것이 끔찍하고 이것으로 땜질을 시도했지만 내가 원하는 방식으로 설정된 첫 번째 요소의 위치를 ​​얻을 수없는 것 같습니다.

여기에 HTML :

<!-- The Timeline -->

<ul class="timeline">

    <!-- Item 1 -->
    <li>
        <div class="direction-r">
            <div class="flag-wrapper">
                <span class="flag">Freelancer</span>
                <span class="time-wrapper"><span class="time">2013 - present</span></span>
            </div>
            <div class="desc">My current employment. Way better than the position before!</div>
        </div>
    </li>

    <!-- Item 2 -->
    <li>
        <div class="direction-l">
            <div class="flag-wrapper">
                <span class="flag">Apple Inc.</span>
                <span class="time-wrapper"><span class="time">2011 - 2013</span></span>
            </div>
            <div class="desc">My first employer. All the stuff I've learned and projects I've been working on.</div>
        </div>
    </li>

    <!-- Item 3 -->
    <li>
        <div class="direction-r">
            <div class="flag-wrapper">
                <span class="flag">Harvard University</span>
                <span class="time-wrapper"><span class="time">2008 - 2011</span></span>
            </div>
            <div class="desc">A description of all the lectures and courses I have taken and my final degree?</div>
        </div>
    </li>

    <li>
        <div class="direction-l">
            <div class="flag-wrapper">
                <span class="flag">Apple Inc.</span>
                <span class="time-wrapper"><span class="time">2011 - 2013</span></span>
            </div>
            <div class="desc">My first employer. All the stuff I've learned and projects I've been working on.</div>
        </div>
    </li>

    <!-- Item 3 -->
    <li>
        <div class="direction-r">
            <div class="flag-wrapper">
                <span class="flag">Harvard University</span>
                <span class="time-wrapper"><span class="time">2008 - 2011</span></span>
            </div>
            <div class="desc">A description of all the lectures and courses I have taken and my final degree?</div>
        </div>
    </li>

    <li>
        <div class="direction-l">
            <div class="flag-wrapper">
                <span class="flag">Apple Inc.</span>
                <span class="time-wrapper"><span class="time">2011 - 2013</span></span>
            </div>
            <div class="desc">My first employer. All the stuff I've learned and projects I've been working on.</div>
        </div>
    </li>

    <!-- Item 3 -->
    <li>
        <div class="direction-r">
            <div class="flag-wrapper">
                <span class="flag">Harvard University</span>
                <span class="time-wrapper"><span class="time">2008 - 2011</span></span>
            </div>
            <div class="desc">A description of all the lectures and courses I have taken and my final degree?</div>
        </div>
    </li>

</ul>

그리고 여기 스타일 시트 :

/* ================ The Timeline ================ */

.timeline {
  position: relative;
  width: 660px;
  margin: 0 auto;
  margin-top: 20px;
  padding: 1em 0;
  list-style-type: none;
}

.timeline:before {
  position: absolute;
  left: 50%;
  top: 0;
  content: ' ';
  display: block;
  width: 6px;
  height: 100%;
  margin-left: -3px;
  background: rgb(80,80,80);
  background: -moz-linear-gradient(top, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(30,87,153,1)), color-stop(100%,rgba(125,185,232,1)));
  background: -webkit-linear-gradient(top, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
  background: -o-linear-gradient(top, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
  background: -ms-linear-gradient(top, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);
  background: linear-gradient(to bottom, rgba(80,80,80,0) 0%, rgb(80,80,80) 8%, rgb(80,80,80) 92%, rgba(80,80,80,0) 100%);

  z-index: 5;
}

.timeline li {
  padding: 1em 0;
}

.timeline li:after {
  content: "";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}

.direction-l {
  position: relative;
  width: 300px;
  float: left;
  text-align: right;
}

.direction-r {
  position: relative;
  width: 300px;
  float: right;
}

.flag-wrapper {
  position: relative;
  display: inline-block;

  text-align: center;
}

.flag {
  position: relative;
  display: inline;
  background: rgb(248,248,248);
  padding: 6px 10px;
  border-radius: 5px;

  font-weight: 600;
  text-align: left;
}

.direction-l .flag {
  -webkit-box-shadow: -1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
  -moz-box-shadow: -1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
  box-shadow: -1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
}

.direction-r .flag {
  -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
  -moz-box-shadow: 1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
  box-shadow: 1px 1px 1px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.15);
}

.direction-l .flag:before,
.direction-r .flag:before {
  position: absolute;
  top: 50%;
  right: -36px;
  content: ' ';
  display: block;
  width: 12px;
  height: 12px;
  margin-top: -10px;
  background: #fff;
  border-radius: 10px;
  border: 4px solid rgb(255,80,80);
  z-index: 10;
}

.direction-r .flag:before {
  left: -83px;
}

.direction-l .flag:after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  height: 0;
  width: 0;
  margin-top: -8px;
  border: solid transparent;
  border-left-color: rgb(248,248,248);
  border-width: 8px;
  pointer-events: none;
}

.direction-r .flag:after {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  height: 0;
  width: 0;
  margin-top: -8px;
  border: solid transparent;
  border-right-color: rgb(248,248,248);
  border-width: 8px;
  pointer-events: none;

}

.time-wrapper {
  display: inline;

  line-height: 1em;
  font-size: 0.66666em;
  color: rgb(250,80,80);
  vertical-align: middle;
}

.direction-l .time-wrapper {
  float: left;
}

.direction-r .time-wrapper {
  float: right;
}

.time {
  display: inline-block;
  padding: 4px 6px;
  background: rgb(248,248,248);
}

.desc {
  margin: 1em 0.75em 0 0;

  font-size: 0.77777em;
  font-style: italic;
  line-height: 1.5em;
}

.direction-r .desc {
  margin: 1em 0 0 0.75em;
}

/* ================ Timeline Media Queries ================ */

@media screen and (max-width: 660px) {

.timeline {
    width: 100%;
    padding: 4em 0 1em 0;
}

.timeline li {
    padding: 2em 0;
}

.direction-l,
.direction-r {
    float: none;
    width: 100%;

    text-align: center;
}

.flag-wrapper {
    text-align: center;
}

.flag {
    background: rgb(255,255,255);
    z-index: 15;
}

.direction-l .flag:before,
.direction-r .flag:before {
  position: absolute;
  top: -30px;
    left: 50%;
    content: ' ';
    display: block;
    width: 12px;
    height: 12px;
    margin-left: -9px;
    background: #fff;
    border-radius: 10px;
    border: 4px solid rgb(255,80,80);
    z-index: 10;
}

.direction-l .flag:after,
.direction-r .flag:after {
    content: "";
    position: absolute;
    left: 50%;
    top: -8px;
    height: 0;
    width: 0;
    margin-left: -8px;
    border: solid transparent;
    border-bottom-color: rgb(255,255,255);
    border-width: 8px;
    pointer-events: none;
}

.time-wrapper {
    display: block;
    position: relative;
    margin: 4px 0 0 0;
    z-index: 14;
}

.direction-l .time-wrapper {
    float: none;
}

.direction-r .time-wrapper {
    float: none;
}

.desc {
    position: relative;
    margin: 1em 0 0 0;
    padding: 1em;
    background: rgb(245,245,245);
    -webkit-box-shadow: 0 0 1px rgba(0,0,0,0.20);
    -moz-box-shadow: 0 0 1px rgba(0,0,0,0.20);
    box-shadow: 0 0 1px rgba(0,0,0,0.20);

  z-index: 15;
}

.direction-l .desc,
.direction-r .desc {
    position: relative;
    margin: 1em 1em 0 1em;
    padding: 1em;

  z-index: 15;
}

}

@media screen and (min-width: 400px ?? max-width: 660px) {

.direction-l .desc,
.direction-r .desc {
    margin: 1em 4em 0 4em;
}

}

난 당황해. 어떤 아이디어?

Daimos

왼쪽 / 오른쪽 위치로 CSS를 수정하십시오.

.direction-l .flag:before,
.direction-r .flag:before {
  position: absolute;
  top: 50%;
  right: -40px;
  content: ' ';
  display: block;
  width: 12px;
  height: 12px;
  margin-top: -10px;
  background: #fff;
  border-radius: 10px;
  border: 4px solid rgb(255,80,80);
  z-index: 10;
}

.direction-r .flag:before {
  left: -40px;
}

작업 바이올린 : https://jsfiddle.net/buaa4zuk/

확실히, 항상 위치를 분리하십시오. 다음과 같이 정의하면 더 명확합니다.

.direction-l .flag:before,
.direction-r .flag:before {
  position: absolute;
  top: 50%;
  content: ' ';
  display: block;
  width: 12px;
  height: 12px;
  margin-top: -10px;
  background: #fff;
  border-radius: 10px;
  border: 4px solid rgb(255,80,80);
  z-index: 10;
}
.direction-l .flag:before
{
    right: -40px;
}
.direction-l .flag:before
{
    left: -40px;
}

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

div를 CSS와 올바르게 정렬 할 수 없습니다.

분류에서Dev

Firefox에서 두 번째 인라인 블록 요소를 올바르게 배치 할 수 없습니다.

분류에서Dev

CSS : 고정 탐색 막대 아래에 요소를 올바르게 배치 할 수 없습니다.

분류에서Dev

정적 리소스를 올바르게 매핑 할 수 없습니다.

분류에서Dev

중첩 된 목록 요소의 첫 번째 요소를 어떻게 분할 할 수 있습니까?

분류에서Dev

첫 번째 div 고정, 두 번째 전체 너비. HTML의 구조를 변경할 수 없습니다.

분류에서Dev

PHP : DOMDocument의 첫 번째 값을 인쇄 할 수 없습니다.

분류에서Dev

CurrentCell 포커스를 DataGridView의 첫 번째 편집 가능한 열로 설정할 수 없습니다.

분류에서Dev

컨테이너의 ReadItemAsync가 Stack <T> 인스턴스를 올바르게 구문 분석 할 수 없습니다.

분류에서Dev

첫 번째 셀의 올바른 색인을 가져올 수 없습니다.

분류에서Dev

첫 번째 필드에 정렬 된 목록, 첫 번째 필드가 동일한 줄에서 두 번째 필드를 어떻게 결합 할 수 있습니까?

분류에서Dev

두 번째 열의 높이를 첫 번째 열의 높이로 어떻게 조정할 수 있습니까?

분류에서Dev

TSQL Xquery-반복 노드의 첫 번째 인스턴스를 선택할 수 있습니까?

분류에서Dev

PHP 동일한 객체의 인스턴스를 2 개 이상 생성하는 경우 첫 번째 객체에서 정보를 검색 할 수 있습니까?

분류에서Dev

SED : Sed를 사용하여 문자열의 첫 번째 인스턴스 이후 모든 줄을 어떻게 인쇄 할 수 있습니까?

분류에서Dev

jQuery Mobile에서 콤보 상자의 첫 번째 요소를 선택할 수 없습니다.

분류에서Dev

번호를 올바르게 표시 할 수 없습니다.

분류에서Dev

개체 배열의 모든 요소를 반복 할 수 없습니다. ngFor 또는 구성 요소의 반복은 첫 번째 요소 만 제공합니다.

분류에서Dev

On Appear는 첫 번째 인스턴스에서만 작동합니다 ... 어떻게 변경할 수 있습니까?

분류에서Dev

셀레늄 ide를 사용하여 첫 번째 행의 요소 클래스를 어떻게 확인할 수 있습니까?

분류에서Dev

PHP 쿠키를 올바르게 설정할 수 없습니다.

분류에서Dev

Qt 4.8 : QStringList의 첫 번째 요소에서 QList <QStringList>를 정수로 정렬하려고합니다.

분류에서Dev

Python matplotlib에 표시 할 첫 번째 막대를 가져올 수 없습니다.

분류에서Dev

스타일이 지정된 구성 요소의 n 번째 하위를 타겟팅 할 수 없습니다.

분류에서Dev

행의 첫 번째 div를 수정하고 다른 div를 스크롤 할 수 있습니까?

분류에서Dev

첫 번째 요소에 액세스 한 후 루프의 xpaths로 나머지 요소에 액세스 할 수 없습니다. 웹 스크래핑 Selenium Python

분류에서Dev

정의되지 않은 속성 '정의되지 않음'을 읽을 수 없습니까? 어떻게 첫 번째 드롭 다운 목록에 숫자를 푸시 할 수 있습니까? 자바 스크립트를 사용하고 계십니까?

분류에서Dev

C에서 쌍의 벡터를 첫 번째 요소로 정렬 한 다음 두 번째 요소로 정렬

분류에서Dev

CSS 요소를 다른 요소 아래에 정렬 할 수 없습니다.

Related 관련 기사

  1. 1

    div를 CSS와 올바르게 정렬 할 수 없습니다.

  2. 2

    Firefox에서 두 번째 인라인 블록 요소를 올바르게 배치 할 수 없습니다.

  3. 3

    CSS : 고정 탐색 막대 아래에 요소를 올바르게 배치 할 수 없습니다.

  4. 4

    정적 리소스를 올바르게 매핑 할 수 없습니다.

  5. 5

    중첩 된 목록 요소의 첫 번째 요소를 어떻게 분할 할 수 있습니까?

  6. 6

    첫 번째 div 고정, 두 번째 전체 너비. HTML의 구조를 변경할 수 없습니다.

  7. 7

    PHP : DOMDocument의 첫 번째 값을 인쇄 할 수 없습니다.

  8. 8

    CurrentCell 포커스를 DataGridView의 첫 번째 편집 가능한 열로 설정할 수 없습니다.

  9. 9

    컨테이너의 ReadItemAsync가 Stack <T> 인스턴스를 올바르게 구문 분석 할 수 없습니다.

  10. 10

    첫 번째 셀의 올바른 색인을 가져올 수 없습니다.

  11. 11

    첫 번째 필드에 정렬 된 목록, 첫 번째 필드가 동일한 줄에서 두 번째 필드를 어떻게 결합 할 수 있습니까?

  12. 12

    두 번째 열의 높이를 첫 번째 열의 높이로 어떻게 조정할 수 있습니까?

  13. 13

    TSQL Xquery-반복 노드의 첫 번째 인스턴스를 선택할 수 있습니까?

  14. 14

    PHP 동일한 객체의 인스턴스를 2 개 이상 생성하는 경우 첫 번째 객체에서 정보를 검색 할 수 있습니까?

  15. 15

    SED : Sed를 사용하여 문자열의 첫 번째 인스턴스 이후 모든 줄을 어떻게 인쇄 할 수 있습니까?

  16. 16

    jQuery Mobile에서 콤보 상자의 첫 번째 요소를 선택할 수 없습니다.

  17. 17

    번호를 올바르게 표시 할 수 없습니다.

  18. 18

    개체 배열의 모든 요소를 반복 할 수 없습니다. ngFor 또는 구성 요소의 반복은 첫 번째 요소 만 제공합니다.

  19. 19

    On Appear는 첫 번째 인스턴스에서만 작동합니다 ... 어떻게 변경할 수 있습니까?

  20. 20

    셀레늄 ide를 사용하여 첫 번째 행의 요소 클래스를 어떻게 확인할 수 있습니까?

  21. 21

    PHP 쿠키를 올바르게 설정할 수 없습니다.

  22. 22

    Qt 4.8 : QStringList의 첫 번째 요소에서 QList <QStringList>를 정수로 정렬하려고합니다.

  23. 23

    Python matplotlib에 표시 할 첫 번째 막대를 가져올 수 없습니다.

  24. 24

    스타일이 지정된 구성 요소의 n 번째 하위를 타겟팅 할 수 없습니다.

  25. 25

    행의 첫 번째 div를 수정하고 다른 div를 스크롤 할 수 있습니까?

  26. 26

    첫 번째 요소에 액세스 한 후 루프의 xpaths로 나머지 요소에 액세스 할 수 없습니다. 웹 스크래핑 Selenium Python

  27. 27

    정의되지 않은 속성 '정의되지 않음'을 읽을 수 없습니까? 어떻게 첫 번째 드롭 다운 목록에 숫자를 푸시 할 수 있습니까? 자바 스크립트를 사용하고 계십니까?

  28. 28

    C에서 쌍의 벡터를 첫 번째 요소로 정렬 한 다음 두 번째 요소로 정렬

  29. 29

    CSS 요소를 다른 요소 아래에 정렬 할 수 없습니다.

뜨겁다태그

보관