css-tables

How to apply text-align left in the first column and text-align right in the others

江枫思渺然 提交于 2020-12-01 08:03:06
问题 I have a Table to style, how can I apply text-align:left; just for the first column and text-align:right; for the other columns? Here my Table example: http://jsfiddle.net/gianlucaguarini/hAv7P/ At the moment the text-align is left for all the columns. 回答1: You need to specify the following CSS: .table td, .table th { text-align:left; } #right, .table td + td, .table th + th { text-align:right; } Example here: http://jsfiddle.net/mWeYM/ You can read more about adjacent siblings CSS selector

Targeting specific column in table

こ雲淡風輕ζ 提交于 2020-06-24 12:07:31
问题 I have a table of class players with 5 columns and 40 rows. I want to make the second column have width: 200px . I can not figure out how to select the specific column in the table. So far I have narrowed it down to this, but this does it to all of the rows in the table. Can someone help me set the column width for a specific column? table.players td { } 回答1: This should work (except on IE8 and below): table.players td:nth-child(2) { width: 200px; } 来源: https://stackoverflow.com/questions

How to remove an html <table> column using only CSS?

99封情书 提交于 2020-04-10 18:46:08
问题 I have an HTML <table> with many columns, so when my web page is displayed on a mobile browser, it's too small. So I'm creating a media query and I want to remove some columns (That are not important). So how to remove an html column using only css ? For example, how to remove the column "B" in the middle of the table on the next example : table, th, td, tr{ border:1px solid black; } table{ width:100%; } <table> <th>A</th> <th>B</th> <th>C</th> <tr> <td>Jill</td> <td>Smith</td> <td>50</td> <

CSS Rounded Table Corners, Gradient Background

社会主义新天地 提交于 2020-03-26 07:19:37
问题 Here's me fiddle: http://jsfiddle.net/6yU6N/10/ I want to work some CSS magic on the table header: Rounded corners in upper left and upper right Gradient color background Gradient border Cross-browser compatibility How can this all be done? 回答1: Gradients : Most modern browsers have implemented these using CSS3 but for Internet Explorer you'll have to use special filters. Since CSS3 is an emerging standard, you have to use browser specific prefixes. .gradient{ background: -moz-linear-gradient

Responsive table issues in bootstrap

大兔子大兔子 提交于 2020-01-25 18:48:45
问题 I am trying to make my table in bootstrap responsive. My issue is that when the window size becomes smaller... I have to scroll the page itself instead of the table. I want to make it so the table scrolls not the page. I have used responsive styling for responsive tables in bootstrap HTML: <div class="wrapper"> <div class="main"> <div class="table-responsive"> <table class="table" id="roleTable"> <thead> <tr> <th>User</th> <th>Email</th> <th>Phone</th> <th>Options</th> </tr> </thead> <tbody>

jQuery table styling vs CSS table styling for alternate rows

陌路散爱 提交于 2020-01-14 22:53:00
问题 Is it faster/better to use CSS with classes on tables for odd/even rows generated on the server or to use jQuery to style stripes on document.Ready() ? I'd like to start using jQuery to make my markup less cluttered but I'm not sure about the performance, particularly for larger (up to 200 rows) tables. 回答1: Depending on browser you may not have a choice. jQuery will work with older browsers like IE7 which don't have the Nth child selector. Ideally you should use css. The stylesheet is the

Table with only vertical lines visible

▼魔方 西西 提交于 2020-01-12 06:31:37
问题 I need a way to show only the vertical lines in a table. I've tried to add border-left and border-right, both with :1px solid #red;, to both the table and the separate td's. but it won't add the border color. So what I'm looking for is an easy way to create these vertical lines. 回答1: Use border-collapse on your <table> than border-left and border-right on your <td> . table { border-collapse: collapse; } tr { border: none; } td { border-right: solid 1px #f00; border-left: solid 1px #f00; }