Why is this text too wide in Firefox? - css

I have a site which uses CSS to create drop caps at the start of articles. This works as expected in most browsers, but Firefox (Linux and Android) displays it incorrectly, but only in certain instances.
On most pages, I get correct output, like this (the blue dashed lines at the side are the edges of the container, shown for illustrative purposes):
However, for a handful of pages, Firefox renders it thus:
Notice that there's a large gap to the right of the drop cap, and the text overflows the box by a corresponding amount.
Here's the relevant SASS:
article .first-paragraph {
text-indent: 0;
&::first-letter {
font-size: 300%;
font-weight:normal;
display: block;
float: left;
margin-right: 0.25em;
padding: 0.5em 0.3em 0.3em 0.5em;
background: $primary-color;
color: $background-color;
border-radius: 50em 5em 5em 5em;
font-family: 'Fredericka the Great', $base-font-family;
}
&::first-line {
font-variant: small-caps;
}
}
I have been unable to discover any difference which can account for this behavior. The articles are written in Kramdown-flavored Markdown and processed by Jekyll. The two articles are absolutely identical in Markdown except for the words themselves. And yet, the bug always happens on the same pages. I've tried setting the first few characters to be the same, but to no avail. I've also made the previous content follow the same structure, where there were differences in structure, but it didn't change anything.
Any ideas what might be wrong, or what I may have forgotten to test?
EDIT
I've narrowed the offending CSS down to the following rules:
article .first-paragraph::first-letter {
display: block;
float: left;
margin-right: 0.25em;
padding: 0.5em 0.3em 0.3em 0.5em;
}
If I turn them all off, the problem goes away. If I turn any one of them on, or any combination, the problem is back, except that display: block causes no issues on its own.
If you want to test it further, here's an example page with the bug (at least until I manage to fix it.
The more I think about it, the more I think that there must be something else on the affected pages beyond what I've posted here, which is causing the issue on Firefox on Linux, Windows, and Android. But for the life of me, I can't figure out what that something else is.

Related

Chrome -- CSS -- Extra spacing

Can anyone look at this template and explain why only in Chrome that it adds a whole lot of extra space at the top of the page?
https://html5up.net/uploads/demos/verti
Update:
Actually, I just discovered that when I'm logged into my work Google account (in the browser as a whole), it adds the extra spacing at the top. When I'm just generally using Chrome (guest mode), it does NOT add the extra space at the top. All on the same computer at my house. Different results depending on if I'm logged in or not. Is there an explanation for this?
Padding for the #header-wrapper element, has the following CSS (main.css - line 1839). This equates to a padding-top: 66px in Chrome...
#header-wrapper {
padding: 4.5em 0 1em 0;
padding-top: 4.5em;
padding-right: 0px;
padding-bottom: 1em;
padding-left: 0px;
}
This would be simple to remove or override, if you needed to... e.g.
#header-wrapper {
padding-top: 10px !important;
}

Dropcap content does not match html

I'm trying to put a dropcap in a paragraph by using a . I think I found the correct workflow and tested it already in another area of my website, it worked great. When I want to apply the same technique to the desired paragraph, the content, the first letter of the paragraph, changes when viewed in browser to "03/". I've tried several different options but always same outcome.. When I inspect element in chrome, it shows "03/" as content, which is not correct. Does anyone know what might cause this?
css:
#services .firstcharacter { /*displays /03 instead of character*/
float: left;
color: #000;
font-size: 75px;
line-height: 80px;
padding-top: 4px;
padding-right: 8px;
padding-left: 3px;
font-family: Georgia; }
html:
<p><span class="firstcharacter">N</span>ulla...</p>
paragraph screenshot
Thanks!
EXTRA INFO
At first I removed #services, but no changes.. Afterwards I wrote code differently like this:
CSS
.service p.char a{
float: left;
color: #000;
font-size: 75px;
line-height: 80px;
padding-top: 4px;
padding-right: 8px;
padding-left: 3px;
font-family: serif;
}
HTML
<p class="char"><a><span>D</span></a>ulla...</p>
But nothing changed.
When I inspect the element in browser (chrome), the span's content has changed to 03/. But when I change it there, the character "D" or whatever is displayed correctly.
Can't really see where this error might be.. I checked my entire code for the "03/" combination as well and changed font settings, but no luck there either.
As I don't know full code, I can only suggest you removing #services from css. Or add <meta charset="UTF-8"> to <head>. Or both.
By dropping the in html, I solved the problem..
Now I have my solution, but would still like to know why this happened.
Thanks for the replies and for helping me find the cause.

CSS draws differently on Mac OSX? (menu bars get pushed one pixel, pushing last button down a row)

For years I've noticed something odd about websites on a Mac, regardless of the browser used. On OS X, I frequently notice CSS responding differently.
I most often see it visually when the last button is pushed down to the next row in a menu because it's a pixel too large. Why does this happen?
Example: http://www.dynamicprint.ca/
Try to update your css with below css rules and you will see the problem is gone.
http://www.dynamicprint.ca/ (line 81)
div.ys_menu a {
color: #000000;
display: block;
float: left;
font-size: 15px;
height: 39px;
margin: 0;
padding: 22px 18px 0;
text-decoration: none;
}
SS:

Sliding doors CSS, button tags and IE8

I'm working on a project to upgrade a system to use the button tag rather than regular submit buttons. For the formatting of the buttons, I have the following CSS classes:
button::-moz-focus-inner {
border: none; /* overrides extra padding in Firefox */
}
button {
background: transparent url('images/greenrightbutton.png') no-repeat scroll top right;
color: #FFFFFF;
display: block;
font: normal 12px arial, sans-serif;
height: 25px;
padding-right: 8px; /* sliding doors padding */
padding-top: 0px;
padding-bottom: 0px;
padding-left: 0px;
margin: 0px;
text-decoration: none;
border: 0px;
overflow: visible;
}
#loginbox button {
float: right;
}
button span {
background: transparent url('images/greenleftbutton.png') no-repeat top left;
display: block;
line-height: 18px;
padding: 4px 5px 5px 12px;
margin: 0px;
border: 0px;
}
They work absolutely perfectly in every browser except IE8.
In IE8, the buttons work in most places, but then I find a page where the two background images don't quite line up and no amount of tweaking padding, line spacing etc fixes it.
Does anyone know why this might be the case?
Demo page: http://test6.placement.co.uk/demo/test.asp
---Update---
After some fairly extensive testing and trying things, I've now got a pretty fair idea of what's causing the problem in page 1, but no idea how to fix it, while another page with the same issue has a completely different cause (which I haven't found) but where I HAVE stumbled on a fix...
The problem on the first page appears to relate to a ul entered further up the page. Take that out and everything behaves - unfortunately, that's not an option as the ul is part of user-entered content, so I'm scratching my head about that. Particularly given...
Page 2 has no uls to cause an issue, but randomly sticking two break tags in just before my button code resolves the problem.
Naturally, THAT fix doesn't work on page 1.
I'm just about ready to give in and find some alternative way of rendering these buttons, because whatever the actual problem is, it's clearly so deep in either my CSS or my basic HTML that I'm probably never going to find it.
I don't see any difference between IE8 and other browser. Could you pleas mention bit more clear what you want to do?

CSS cross browser issue

IE6,7 are givimg me grieves on browser display. I didnt have prblems with Safari nor FF.
I'm not a CSS expert and in need of advice for this column alignment issues on IE.
And I don't know where to begin because I've tried messing around with the css files and the css browser selector javascript and still I can't get it to work on IE.
The problems I believe center around id doc, bd, yui-main, yui-b, box and box-titles.
For unclear reasons, the sizes show differently in IE from other better browsers.
The sizes width and height values are different.
<body>
<div id="doc" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div id="header" class="yui-g">
<a href="index.php">
:
:
unfortunately, the 2 css files are a little overwhelming over me to understand.
I tried pasting it here but the format got out of whacked.
Could someone lend a helping hand ?
Any help is appreciated.
app.css
body {
font-size: 85%;
font-family: "georgia";
}
.yui-t2, #bd, #yui-main {
z-index: -5;
}
.yui-b, .yui-g {
z-index: auto;
}
div.yui-b div.box {
color: #333333;
border: 1px solid #c6e1ec; /* this controls the left boxes on front page */
margin-top: 15px;
}
div.yui-b div p.box-title {
/* background: #0590C7;
border-bottom: 2px solid #c6e1ec; */
background: #6f6f6f;
border-bottom: 2px solid #c6e1ec;
color: #FFFFFF;
display: block;
font-size: 93%;
font-weight: bold;
margin: 1px;
padding: 2px 10px;
}
div.yui-b div ul {
margin: 0;
}
div.yui-b div ul li {
border-bottom: 0px solid #fff;
list-style-type: none;
}
div.yui-b div ul li a {
color: #333333;
display: block;
text-decoration: none;
padding: 3px 10px;
}
div.yui-b div ul li a:hover {
background: #c6e1ec;
color: #333333;
}
grids-min.css
body
{text-align:center;}
#doc,#doc2,#doc3,#doc4,.yui-t1,.yui-t2,.yui-t3,.yui-t4,.yui-t5,.yui-t6,.yui-t7
{margin:auto;text-align:left;width:57.69em;*width:56.301em;min-width:750px;}
.yui-b{position:relative;}
.yui-b{_position:static;}
#yui-main .yui-b{position:static;}
#yui-main
{width:100%;}
.yui-t1 #yui-main,.yui-t2 #yui-main,.yui-t3 #yui-main
{float:right;margin-left:-25em;}
.yui-t4 #yui-main,.yui-t5 #yui-main,.yui-t6 #yui-main
{float:left;margin-right:-25em;}
:
:
more but format is bad over here at stackoverflow to make it readable.
I apologise for I don't wish to come across in this post as unhelpful or rude.
Sincerely
This is a useful resource for dealing with ie6 generally
http://www.virtuosimedia.com/dev/css/ultimate-ie6-cheatsheet-how-to-fix-25-internet-explorer-6-bugs
There are many many possible IE6/7 issues. Particularly IE6.
First thing to check is does your HTML code include a valid <!DOCTYPE> declaration? If not, your page will go into quirks mode, which will make all versions of IE (but IE6 in particular) go nuts. Quirks mode is effectively an IE5 compatibility mode. It is badly broken, so make sure you have a doctype.
Second thing to do is read up on some of the IE issues that may be giving you problems, and on browser support for some of the features you may be using. There's a very good website called (appropriately enough) Quirksmode.org which has a comprehensive set of compatibility tables for a wide range of browser features.
The following sites may also help:
http://haslayout.net/css/index
http://css-class.com/test/bugs/ie/ie-bugs.htm
http://positioniseverything.net/explorer.html
Google is your friend here too. ;-)
Next tip, try to narrow down your problem. Strip out the bits that are working until you end up with a page that demonstrates the problem with the minimum of other stuff getting in the way. Save that example to a site like JSFiddle. It'll be easier to work out the issue if you know exactly what the issue is.
Finally, if the remaining issues are minor display glitches that don't prevent the page being used, you should give yourself permission to simply ignore them. The market share for both IE6 and 7 has been dropping rapidly over the last year, and will continue falling. There's very little to be gained by spending too much time sweating over minor issues in these browsers.
See here for up-to-date browser usage stats: http://gs.statcounter.com/#browser_version-ww-monthly-200911-201011
(obviously if your site has significantly different demographics, you may need to pay more attention to IE6 and 7, but if that's the case you'll know already)

Resources