By mboy-1 on
All the table in drupal site is not 100%, it is content related, say, the longer the title, the wider the width of the table. I want all the table is 100% width regardless the content. How can I do that?
I tried to put an
table { width :100% }
in style.css, no success.
searched google and drupal forum about 4 hours, still can not find a solution.
Thanks a lot!
Comments
It sounds like you want a
It sounds like you want a fixed width table - 100% won't help you there. Try specifying the width in pixels - say 600px and see what happens.
More CSS files
I'm not familiar with the News Portal theme, but it maybe worthwhile to have a look around in the /misc folder. There are more CSS files in there, for example misc/drupal.css, misc/maintenance.css and misc/print.css.
Weird,
because
table { width:100%; }works just perfect for me. I used it plenty of times. The only thing I can imagine is that it's overridden later on in your code.I tried to change a lot CSS, no success.
I created an example on http://www.chicagocomputerclub.com/?q=forum
The table is shrinked because of no title in it, if you put some title there, then it will become wider. but it is not 100%.
When I change to the defaul drupal theme: bluemarine. All the tables are 100% width. include all the tables in the administrator menu, like
?q=admin/themes
?q=admin/filters
But once I changed to other themes, they all shrinked to the diffetent size.
So what should I change to make the table width 100% like the default theme achived?
Thanks a lot!
Daniel
It works if you place it at the end of style_screen.css
If you place
at the end of style_screen.css it will make the tables in side .content2-container 100% of the width.
A word of warning, you should check this in IE has it may break things, often you want to set width to some where betwee 96% and 98% so that IE works as intended.
Thanks! it worked.
But I change to another theme, and added the lines in the sytyle.css since the theme doesn't has a file named style_screen.css , it not working. Is there any ways I can figure out what should I add? Thanks very much!
http://www.chicagocomputerclub.com/?q=forum
same page, forum are fine, the table I created with views is not good. Why?
Daniel
For most themes the file to modify will be style.css
For that theme it would be
td.content table {
width: 100%;
}
In general terms I use Firefox and the Web Developer extentsion
Under 'Outline' is 'Outline Current Element'
Place the mouse over the table and in the status bar you
will see the "path" to the table (all the elements the table is contained in)
I look for one that only contains the content area (not header, footer or sidebar)
so the rule only applies to table in that area.
Thank! That's exactly what I need.
I followed your instruction, it worked. Thanks!
having issues...
i am adding a block with a tabled menu in it.
there are a few rows that are just supposed to have a 1 px high cell, but there seems to be space above and below the 1 px image.
I have looked around as well as made my own table class, but nothing removes the space above and below the i px image (causing the cell to be much taller than 1px.).
I looked for that other main drupal css file, but didnt see anything.
.... and to make it more frustrating, in IE it looks great, but FireFox shows the spaces above the image in the cell.
(i installed that Web Develoepr Ext for FF and it's great thanks)
======================================
======================================
UPDATE.
I thought my issue may be similar, but it turns out that the DOCTYPE was causing the change in layout. For some reason, which I have not had a chance to fully understand why, the doctype was causing the breaks in the table layout and adding vertical space in the cells. something I found here helped: http://alistapart.com/stories/doctype/
======================================
======================================
Same problem, i dont get it...
I had the same problem in Drupal 6. Fixed with:
.view table { width: 100%; }
Howver, i admit it was not that simple. I am pretty i had tried that before and it didnt work.. I have no idea why it worked the last time.... bah, as long as it does :)