开发者

How to control font size in an eBay listing

I am trying to control font size in an eBay listing such that it will look the same (more or less) on Firefox and Internet Explorer 8.

To simplify things I just specify a single font size for the entire body text:

<body style="font-family: Verdana; font-size: 12px;">
 ...
</body>

Yet, while locally (on my PC) the font looks as I want it to look like:

Firefox 3.6:

How to control font size in an eBay listing

Internet Explorer 8:

How to control font size in an eBay listing

On eBay itself, the font looks much bigger (which is not what I want):

Firefox 3.6 on eBay:

How to control font size in an eBay listing

Internet Explorer 8 on eBay:

How to control font size in an eBay listing

I tried of course different font-size unit specification (em, %, etc.) but the discrepancy remains.

Why is this happening a开发者_JS百科nd how can I get around this (without resorting to posting an image of the text...).

I understand that there might be some collision between eBay's CSS and my HTML (I don't use any CSS, I only use inline style!), but I don't know how to tell eBay not to override my style.

Any idea how to overcome this?


Might be a dirty trick, but have you tried overwriting the CSS using the !important declaration?

Like so:

foo: bar !important;

I would suggest you open up Firebug on Firefox (or Chrome's inspector on Google Chrome) and see what styles are overwriting the ones you added.

Another thing to try is adding those styles (the whole style= attribute) to the text blocks itself. If that works, your code just isn't specific enough.


Your problem seems to be selector specificity. Here's what that means:

If I have CSS which applies to all of the elements in a document:

body * {
  foo: bar;
}

It will be overridden by a more specific selector, like this:

body p {
  foo: baz;
}

Because the p is selecting a specific element, while the * broadly selects all of them.

When you apply the style= attribute, like this <body style="..., you are making that CSS very unspecific, like the first chunk of code.

Instead, apply the style= attribute to your HTML:

<body>
  <p style="...">My content</p>
</body>

Try to get it as specific as possible, as specific selectors override non-specific ones.


The answers above are all incorrect, or useless.

You should make each element more specific by wrapping your entire auction code in an id element, such as straight after the < body > tag, put

<div id="myauction">

Insert your auction code here.

</div><!-- END OF MYAUCTION -->
</body>

If you find that some elements are still not working properly, then put them into yet another id element too, such as

<div id="column1">
<div class="itemdetails">
<h2>Item name</h2>
<p>Item description</p>
</div><!-- END OF ITEMDETAILS -->
</div><!-- END OF COLUMN1 -->

Then use CSS something like #myauction #column1 .itemdetails h2 {color:black; etc...} #myauction #column1 .itemdetails p {font-family:Helvetica; etc...}

That will make the h2 and p tags more specific (probably) than anything the Ebay CSS is doing to them.

Blender (above) doesn't know what he's talking about, by the way. Bad advice is worse than no advice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜