2017-01-31 1 views
-2

HTML 테이블의 내용이 올바르게 설정되지 않았습니다. 그리고 가능한 모든 방법을 시도해 보았지만 아직 해결할 수 없습니다. 보세요.테이블 내용이 정렬되지 않음


          
  
.abc{ 
 
border-radius: 20px; 
 
background-color: #f2f2f2 ; 
 
padding: 20px; 
 
opacity: 0.8; 
 
margin-top: -50px; 
 
margin-left: -100px; 
 
position: fixed; 
 
top: 30%; 
 
left: 45%; 
 
} 
 

 
table { 
 
border-collapse: collapse; 
 
width: 100%; 
 
} 
 

 
th, td { 
 
text-align: left; 
 
padding: 8px; 
 

 
} 
 

 
tr:nth-child(even){background-color: #f2f2f2} 
 

 
td { 
 
background-color: #ffa64d; 
 
color: black; 
 

 
}
<h1><samp>Student Details</samp></h1> 
 
<p> <%= link_to "Add new record", new_user_path %></p> 
 
<table border=3> 
 
<tr> 
 
    <th>Firstname</th> 
 
    <th>SecondName</th> 
 
    <th>Address</th> 
 
    <th>Action</th> 
 
    </tr> 
 
<% @users.each do |user| %> 
 
<table border=3> 
 
<tr> 
 
    <td><%= user.firstname%></td> 
 
    <td><%= user.lastname%></td> 
 
    <td><%= user.address %></td> 
 
    <td><%= link_to "Delete",user,:method =>:delete, 
 
    data:{:confirm => 'Are you Sure?'} %><br><%= link_to "Edit", edit_user_path(user) %></td> 
 
</tr> 
 
</table> 
 
<% end %>
+0

피들을 제공 해주시겠습니까? –

+1

"HTML 표의 내용이 올바르게 설정되지 않았습니다."- 어떤 표가 사용됩니까? HTML을 제공하지 않았습니다. 이 맥락에서 "적절하게"의미하는 것은 무엇입니까? – Quentin

+0

https://jsfiddle.net/aniket5689/0hj1fyew/ –

답변

-2

당신이 달성하려고하는지 모르겠지만, 난 당신의 코드에서 무엇을보고에서, 나는 이것이 당신이 찾고있는 무엇을 생각 :이

을하는 데 도움이 내가 희망

vertical-align: middle; 

+2

"달성하려는 내용을 알지 못합니다"- 질문에 대답하려고해서는 안됩니다. – Quentin

+1

'vertical-align : middle;'- 이것이 테이블의 기본 설정이므로 아무 것도하지 않을 것입니다. – Quentin

+0

동일한 열에있는 열의 정렬을보십시오. 나는 바이올린을 다시 업데이트했습니다. –

-1

문제는 그냥 그 여분의 테이블 태그를 제거 두 번째를 정의하기 전에 테이블에서 설명하는 추가 <table> 태그이었다

.abc{ 
 
border-radius: 20px; 
 
background-color: #f2f2f2 ; 
 
padding: 20px; 
 
opacity: 0.8; 
 
margin-top: -50px; 
 
margin-left: -100px; 
 
position: fixed; 
 
top: 30%; 
 
left: 45%; 
 
} 
 

 
table { 
 
border-collapse: collapse; 
 
width: 100%; 
 
} 
 

 
th, td { 
 
text-align: left; 
 
padding: 8px; 
 

 
} 
 

 
tr:nth-child(even){background-color: #f2f2f2} 
 

 
td { 
 
background-color: #ffa64d; 
 
color: black; 
 

 
}
<h1><samp>Student Details</samp></h1> 
 
<p> <%= link_to "Add new record", new_user_path %></p> 
 
<table border=3> 
 
<tr> 
 
    <th>Firstname</th> 
 
    <th>SecondName</th> 
 
    <th>Address</th> 
 
    <th>Action</th> 
 
    </tr> 
 
<% @users.each do |user| %> 
 
<tr> 
 
    <td><%= user.firstname%></td> 
 
    <td><%= user.lastname%></td> 
 
    <td><%= user.address %></td> 
 
    <td><%= link_to "Delete",user,:method =>:delete, 
 
    data:{:confirm => 'Are you Sure?'} %><br><%= link_to "Edit", edit_user_path(user) %></td> 
 
</tr> 
 
</table> 
 
<% end %>

-1

감사합니다. 문제가 해결되었습니다. 문제를 일으키는 표 및 종료 태그를 이동했습니다.

관련 문제