I have a bookmarklet that inserts a widget into any site's pages. The styling of the widget is being broken by a certain site that has the following CSS @font-face
declaration:
@font-face {
font-family: "helvetica";
src: url("http://cdn2.yoox.biz/Os/fonts/helveticaneueltstdmdcn.eot?iefix") format("eot"),
url("http://cdn2.yoox.biz/Os/fonts/helveticaneueltstdmdcn.woff") format("woff"),
url("http://cdn2.yoox.biz/Os/fonts/helveticaneueltstdmdcn.ttf") format("truetype"),
url("http://cdn2.yoox.biz/Os/fonts/helveticaneueltstdmdcn.svg#svgFontName") format("svg");
}
The widget that my bookmarklet inserts uses helvetica everywhere and on this one site it looks horrible because the browser is mapping helvetica to the @font-face
declaration of that name rather than the standard helvetica system font.
The question: is there any way to override/bypass this @font-face
declaration or create another @font-face
declaration that maps to the system helvetica font?
However, some font families are considered "web-safe fonts," (e.g., Arial, Verdana, Helvetica [sans-serif fonts], Georgia, Garamond, [serif fonts], and Courier New [monospace font]) while others are not — and many web-safe fonts are pre-installed on a wide range of computer systems and devices.
Helvetica is not included as a default font on Windows computers. Many typefaces look like Helvetica that may already exist in your computer's font collection.
Unless the stylesheet overrides it by referencing the stylesheet with !important
after your widget's stylesheet, this could work:
@font-face {
font-family: 'ProperHelvetica'; /* Make a name for the "proper" Helvetica */
src: local('helvetica'); /* Assign it to the Helvetica font on the user's system */
}
.your-widget {
font-family: 'ProperHelvetica', helvetica, sans-serif !important; /* Make everything
in your widget use the "proper" Helvetica and if the user doesn't have it,
use the site's helvetica. */
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With