Question:
Why does my CSS code not work in Opera like IE?
UBigDummie
2006-11-30 18:44:11 UTC
I am using an external style sheet and the code works great in IE, but it doesn't work in Opera. There's just one bit that isn't working. What I am trying to do is put a dashed border around a table. The code I am using is:

p.table-general {border-style: dotted; color: #CECF9C; }

Can anyone help me with this?
Three answers:
Cedric
2006-11-30 18:56:02 UTC
If you want to have a dashed border, you should use "dashed" not "dotted".



second problem, according to your css snippet, you have your table embeded into a paragraph, which is not correct html. You cannot have a table within a paragraph (although a paragraph within a table is fine).



third, Opera is very picky with code. if you have any error in it, it won't try as hard to guess what you meant (and this _is_ a good thing!).



Validate both your html and css code (check out w3c validators).



Ok, back on topic, the exact reason it doesn't work is that you didn't say how thick the border should be nor its color. No wonder nothing shows up. Here's a working example:



paragraph

















.table-general {

border: 1px dashed black;

}
Chris B
2006-12-01 04:05:03 UTC
1. You are referencing a paragraph with a class name of table-general which doesn't sound like it applies to a paragraph but rather a table. Either change the name to something more semantic to the element it references or remove the paragraph element from the CSS selector.



2. Add a color and width for the border. Without a border-width, Opera reads your code as a border of 0px. You can use a CSS shortcut to put all three attributes in one line. Here is an example:

border: 1px dashed #000000;
anonymous
2006-12-01 02:50:51 UTC
Your designator says that table-general only belongs to the p element, not the table element.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...