tags:

views:

31

answers:

2

Hi , I wonder why align doesn't work when used in external style sheet but works fine in inline (correct me if I'm wrong) and also I can't use both align and external styilng by using an id for div

http://www.jsfiddle.net/pahnin/rdgbq/5/

+1  A: 

This is incorrect. CSS rules work the same way, whether they are defined in external style sheets or in inline CSS.

There are some mistakes one can make when embedding external style sheets, for example using a title attribute in the link tag, or using the wrong media attribute.

Maybe one of these things causes your external style sheet not to work. In that case, show the code you are using to embed it.

Pekka
@pekka, i think the OP refers to inline as in the `style` attribute, which takes priority over all other css rules..
Gaby
@Gaby I agree, but that doesn't explain why it wouldn't work in an external style sheet, does it?
Pekka
@Pekka, yes you are right.. i got confused and thought he was using both .. but he does not say this .. wrong assumption.
Gaby
i added a link with jsfiddle
pahnin
+1  A: 

Inline styles have a higher priority that either embedded or external styles (this is a core principle of cascading style sheets). I sounds highly likely that you have an align that is inadvertently affecting your element, which is overwritten when you use inline styles.

** edit **

I see what you mean now - your align is actually an HTML attribute, not CSS - and align=center doesn't work with block elements the same way you would expect it to with tables.

Fortunately it's easy to fix as you have set widths for the logo and footer. Simply set equal left and right margins of 45% to your logo element (and remove the align=center).

#logo {
    margin: 0 45%;
}
John Catterfeld
see the link i added there using id and external styling is disabling inline align
pahnin
Here's the solution if you're attempting to centre the logo on the page.
John Catterfeld