나는 CSS를 전혀 모른다는 말로 머리말을 붙이겠습니다. 나는 CSS와 자바 스크립트를 사용하여 성능 표시 줄을 만들려고하고 있는데, 지금까지 막대 배경을 만든 다음 지정된 백분율로 채우는 막대를 만듭니다. 내 문제는 "안쪽 바"가 아래쪽에서 위쪽으로 아래로 내려 오는 것입니다. 100에서 백분율을 빼고 절대 값을 취할 수는 있지만 더러운 해킹 같은 것 같습니다. 나는 이것이 꼭대기에서 시작해서 자라기보다는 높이가 자라면서 이것이 바닥에 정렬되도록하고 어떻게 성장할 수 있는지보고 싶습니다.CSS와 Javascript의 수직 정렬 문제
CSS 코드
.cssSmall .performanceBack
{
position: absolute;
z-index: 1;
height: 20px;
width: 18px;
top: 4px;
left: 81%;
background-color: Brown;
}
.cssSmall .performanceBar
{
font-size: 6px;
vertical-align: top;
background-color: Orange;
}
자바 스크립트 코드
this.performanceBack = gDocument.createElement("performanceBack");
this.performanceBack.className = "performanceBack";
div.appendChild(this.performanceBack);
this.performanceBar = document.createElement('div');
this.performanceBar.className = 'performanceBar';
//Hard coded value for testing
this.performanceBar.style.height = '30%';
this.performanceBack.appendChild(this.performanceBar);
감사합니다. 이미 position: absolute
에 .performanceBack
을 설정 한 이후
에 행동에 그것을 볼 수 있습니까? –
그것은 내가했던 첫 번째 것과 같았습니다. – user535617