Google fonts — partial rendering in Google Chrome - css

I use Google Open Sans font (https://fonts.google.com/specimen/Open+Sans) with cyrillic. And if I have stressed word ( ́ — accent symbol is missing in font-set), Google Chrome renders only the part after accent. But another browsers haven't same problem.
Rendering comparison:
I understand that every browser has own render-engine, but I very want to solve or avoid this trouble. What should I do?
.open-sans-font {
font-family: "Open Sans";
}
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700&subset=cyrillic" rel="stylesheet">
<div class="open-sans-font">
<p> філігра́нний — несамови́тий </p>
<p> філігранний — несамовитий </p>
</div>

I simply added “text=...чшщьюя́” to my Google Web Fonts API request.
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700&text=АБВГҐДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯабвгґдеєжзиіїйклмнопрстуфхцчшщьюя́" rel="stylesheet">
It turns out that the accent symbol belonged to latin-ext charset

Taking it as you want to make sure the width is the same for that line. I would ass a class to that <p> for example
<p class="RenderTrouble">філігра́нний — несамови́тий</p>
And in your css put
.RenderTrouble {
max-width: 200px; /* Or how ever many pixels it is long */
}
And that should do it. the only problem is finding how many pixels long the edge render is.
I'll do the math;
1398 -19 = 1379
The length of the sentence is 1379px so make the css
.RenderTrouble {
max-width: 1379px; /* Or how ever many pixels it is long */
}
Well in theory anyway. it isn't working for me so I'm afraid you're out of luck. I will keep trying to see if I can get it
I give up here
<img src="./Untitled.png" style="max-width: 210px; height: 120;">

Related

Capitalize issue with bracket text/content

I have HTML page where I have many labels added with (s) like Cat(s), Dog(s), Page(s), etc and I have CSS property for them as
<html>
<head>
<style>
label{
text-transform: capitalize;
}
</style>
</head>
<body>
<label>Cat(s) : 5</label>
<label>Dog(s) : 4</label>
</body>
</html>
it is working fine on most of the browsers but some like chrome are showing (s) as capital (S), but it should not be.
Check https://codepen.io/vikramtalkin/pen/ZdeQmW on chrome and firefox, on firefox it shows properly but on chrome it shows (S)
Please suggest possible solutions.
The simplest that comes to mind, using CSS and with the existing markup, is to use :first-letter.
With :first-letter it will only capitalize the first letter in label's, and leave the s in (s) be.
Do note, the label need to be displayed block or inline-block
Stack snippet
label {
display: inline-block;
}
label::first-letter {
text-transform: capitalize;
}
<label>Cat(s) : 5</label>
<label>Dog(s) : 4</label>
<label>cow(s) : 5</label>
<label>horse(s) : 4</label>
Edit
Based on a comment, where there might be more than just one word.
In a sentence like "i have dog(s)" one can't capitalized arbitrary words, e.g. "I" and "Dog" but not "have". For that you need a script.
If to capitalize all words, you can't use :first-letter, and if so, you need to wrap the text that should be capitalized, in e.g. a <span>, to avoid the "s" in "(s)" to be affected (how Chrome does).
And note, it works the same way in Opera and Edge, as it does in Chrome, and likely in Safari as well, given it also use WebKit, so I guess it is only in FireFox the "(s)" isn't affected.

Text Overlap in CSS

Just a quick question - I was unable to find this when I searched, but I'm sorry if it's a repeat.
I have paragraph tags enclosing the title of my website:
<div class = "title">
<p>Welcome to homepage!</p>
</div>
<div class = "subtext">
<p> Subtext goes here </p>
</div>
<div class = "formthing">
<form method = "GET" action = "/form">
<input type = "submit" name = "submitted" class = "btn-large" value = "Click button" />
</form>
</div>
and everything is working fine. However, when I zoom in on the page, the words of the title overlap themselves. Is there anything I can add to CSS to prevent this from happening?
i dont see any overlap in your code, but a quick fix would be to can add margins to your classes via css to prevent overlaping.
eg:
<style>
.formthing {
margin: 0.25em;
}
</style>
You need to use em font-sizing in your CSS. If you don't know what this is, this is a really good article on it: http://kyleschaeffer.com/development/css-font-size-em-vs-px-vs-pt-vs/
Essentially em is just another way of expressing a percentage but some browsers falter at higher and lower levels of zoom when using pt, px and % values. Using em mitigates this issue the best.
font-size: 16px;
font-size: 100%;
font-size: 1em;
Most modern browsers will default to 16px font-size as the control and adjust off of that, making the above 3 font-sizes equal to each other (give or take some decimals in Firefox and IE). This isn't fool-proof but for the most part will get you through these situations. It's a very widely practiced and proven method of preventing unexpected text and element overlapping.
Also - might wanna look into the font you're using and whether there is any kerning applied and maybe utilize letter-spacing: 1px; and adjust accordingly.
Don't forget to use a CSS reset like Normalize.css.

Netscape Incorrectly Renders Floating Share Bar

I have been experimenting by adding a floating social media share bar to my web page.
The bar renders perfectly in I.E, Firefox, Opera, Chrome, and Safari, but refuses to behave when viewed in Netscape Navigator 9.
It's important for the bar to render properly in all of the above, and thought the problem might perhaps be due to something else on my web page interfering with its correct operation. However, when I test the bar using the mock up page I have posted a link to here, the same problem still exists.
Can anyone suggest what alterations I might make to the source code in order for this problem to be overcome?
Here's a link to my demo page.
http://www.corncreations.co.uk/test/floating_bar.html
Here's a link to the creators page, which includes the source code.
http://www.myblogger-tricks.com/2013/09/add-awesome-floating-sharing-bar-on.html
Any constructive advice gratefully received.
The code used for the demo is available by visiting the second of the links (above), but anyway, here it is:
<style type="text/css">
#floating_bar {
background-color:#fff;
position:fixed;
padding:0 0 3px 0;
bottom: 30%;
margin-left:-60px;
float:left;
border: 1px dotted #f7f7f7;
border-radius: 5px;
-moz-border-radius:5px;
-webkit-border-radius:5px;
z-index:10;
}
#floating_bar {
clear:both;
}
</style>
<div id='floating_bar'>
<div style='margin:10px 0 5px 13px;' id='like'>
<div class="fb-like" data-send="false" data-layout="box_count" data-width="40" data-show-faces="false"></div>
</div>
<div style='margin:0px 0 0 10px;' id='gplusone'>
<g:plusone size="tall"></g:plusone>
</div>
<div style='margin:5px 5px 5px 6px;'>
Tweet
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</div>
<div style='margin:5px 5px 5px 5px;' id='linkedin'>
<script src='http://platform.linkedin.com/in.js' type='text/javascript'></script>
<script data-counter='top' type='IN/Share'></script>
</div>
<div style='margin:0 0 10px 11px; id='su'>
<script src="http://www.stumbleupon.com/hostedbadge.php?s=5"></script>
</div>
<p style='line-height:0px; margin-bottom:8px; font-size:10px; font-weight:bold; text-align:center;'><a href='http://www.myblogger-tricks.com/2013/09/add-awesome-floating-sharing-bar-on.html' rel='nofollow' style='color:#333;'> Get Widget</a></p>
</div>
As to what I've researched and tried so far - I've read other posts on this forum, and also Googled for an answer, but apart from reading a few posts elsewhere from others having difficulty with their Facebook Like buttons not rendering properly in Netscape, nothing else seemed relevant. I haven't tried altering the original source code yet, as I am not sure what to do that might correct the problem.
1. There's a point when backwards compatibility goes too far.
why Netscape fails to render the bar in the same way as all the other main browsers
You're implying that Netscape is a "main browser" like the browsers you mentioned in your question. Netscape used to have a significant market share, but its time has passed (see History of the web browser on Wikipedia, specifically the timeline chart at the bottom of the article; Also Usage share of web browsers for current statistics).
It makes the question irrelevant from a practical standpoint. It's hard to justifying the question let alone finding an answer, given that you're attempting to support a legacy browser.
But let's assume you have a valid reason for supporting a browser that is virtually extinct...
2. What is the problem?
"The bar ... refuses to behave"
You might as well be saying, "it doesn't work". How doesn't it work? What is the expected behavior, and how is the actual result deviating from your expectation? You shouldn't expect us to download a browser that hardly anybody has used for over a decade to confirm an ambiguous bug description (SSCCE).
3. Your HTML is funky
No formatting The lack of indentation isn't a technical concern (only a nitpick), but makes it hard to read
Inconsistent use of quotes The general practice is to use double quotes " for HTML attributes. For example: <div id="floating_bar">.
**Is that ! supposed to be there in the <script/> tag?
<g:plusone/> is not a valid HTML tag. Were you trying to do something like this?
The CSS is probably not working because the bottom property is set as a percentage. Support for bottom/right was pretty spotty at first, and percentage might be iffy.

Page renders differently on refresh within same browser

I have an unusual problem that's driving me crazy! I haven't found a question posted yet that pertains to this exact issue.
I have a page on my site where certain elements render incorrectly on random page loads. Using chrome for example, the page will render normally but after a number of refreshes a basic ul in the header will shift down into the body. Sometimes a carousel won't appear, or a navigation block will slide to the next row. I have duplicated this behavior on Firefox as well.
I can't really give a snippet of code for anyone to look at because I have no idea where the issue is originating from. The page with the issue is the index of www.Calibrus.com.
What's really amazing is that by using Chrome Dev Tools I can set display:none to the incorrect ul, then set display back to normal, and the ul renders where it should again. This suggests to me that the exact same html and css is somehow rendering differently (regardless of any scripts being used).
Also, this isn't an issue with the server. I have the same problem when running the code locally.
Does anyone have any idea whats going on here?
I believe the issue is tied to floats and the slideshow javascript.
Whenever I triggered the layout bug on the live site, it was accompanied by the first slide not rendering correctly. This would cause <div id="r1"> to have a height of 0 which in turn seems to aggravate the afore mentioned float bug. There seems to be some tension between the <ul> which is floated and the <a> which is not.
This is the solution that worked for me:
In index.html add a class (or ID if you prefer) to allow yourself to target the link within the CSS. In this example I have simply given it a class of logo:
<a class="logo" href="index.html">
<img src="images/Calibrus_logo.png" alt="logo" border="0">
</a>
Then, in your CSS:
// target the link using your chosen selector
.logo {
display: block;
float: left;
}
Once I added those rules, I could no longer replicate the rendering bug.
Side note:
I would recommend declaring your character encoding just after the opening <head> tag with <meta charset="utf-8">.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Calibrus</title>
Also, the border attribute for images has become obsolete. So rather than:
<img src="images/Calibrus_logo.png" alt="logo" border="0">
Simply target the <img> with CSS and declare:
.logo img {
border: none;
}

Why doesn't the text change color when I edit the css page?

I created a new web application in visual web developer. I saw that the title of "Site.Master" (in code) is:
<div class="title">
<h1>
My ASP.NET Application
</h1>
</div>
So I opened "Site.css" and added:
h1
{
font-size: 1.6em;
padding-bottom: 0px;
margin-bottom: 0px;
color:Blue;
}
Showing "Default.aspx", though, doesn't show the text ("My ASP.NET Application
") in blue. Why?
EDIT: From the source code:
<body>
<form runat="server">
<div class="page">
<div class="header">
<div class="title">
<h1>
My ASP.NET Application
</h1>
So I added color: Blue; in the css under body, page, header, title, and h1. I rebuilt, and pressed Ctrl + F5. Doesn't help. I'm trying this in IE and Firefox.
The stylesheet is probably cached on the browser. Clear your browser cache, and you should see the change.
Also, You probably did this for emphasis, but you don't need to surround the css in asterisks.
You can prevent this from occurring in the future by appending a query string to the css link:
<link rel="stylesheet" type="text/css" href='site.css?v=<%= DateTime.Now.Ticks %>' />
Something like this will cause the browser to download the css file every time the page is requested.
Update your css like below.
.title h1
{
font-size: 1.6em !important;
padding-bottom: 0px !important;
margin-bottom: 0px !important;
color:Blue !important;
}
from: http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/
Specificity is calculated by counting various components of your css
and expressing them in a form (a,b,c,d). This will be clearer with an
example, but first the components.
Element, Pseudo Element: d = 1 – (0,0,0,1)
Class, Pseudo class, Attribute: c = 1 – (0,0,1,0)
Id: b = 1 – (0,1,0,0)
Inline Style: a = 1 – (1,0,0,0)
So, the class of div is over-riding the element setting of h1.
Try
color: blue;
instead of
**color:Blue;**
Two things:
It's possible you just need to do a "hard refresh" of the page. Try pressing Ctrl + F5 and see if that helps.
You may need a more specific selector to control that element if another CSS rule is affecting it. Try changing "h1" to ".title h1"
i dont know why it happens but u need to clean firefox cache and cookie then it works.
This cases are common and almost no solution to this issue (sadly, little can be done) if and only if your web page content was sourced from a template online. To confirm this, create two web forms with different templates and both web forms share the same 'sitemaster' page. it kind of inherits content design.

Resources