CSS creating problems for cache? - html

I was making a website and after doing some coding with css, I pushed the data to my hosting. But, the website css wasn't showing up what is was supposed to be! I got a lot of support here, discord, and namecheap (my hosting). And they all said it has to do with browser caching.
After doing some experiments I concluded that it changes with wifi connection. I went to my school wifi and the css looked normal, but back home it didn't look what it was supposed to.
I isolated the error and found it had to do with 1 css file. But after taking the identical code to a different file it worked fine. Granted, the code did change while I was putting it into a different file since there was css there before.
Here is the code that seemed to cause it:
h1 {
font-family: "JetBrains Mono ExtraBold", monospace;
color: #2474ff;
text-align: left;
float: left;
margin: 5px 30px;
font-size: xxx-large;
box-shadow: 0 0 25px 5px #0ff;
border: solid dodgerblue 4px;
border-radius: 15px;
animation: crazy 3s infinite;
}
#keyframes crazy {
50% {box-shadow: 1px 2px 3px blue}
}
.content {
font-family: "JetBrains Mono", monospace;
font-size: 14px;
border: 4px solid dodgerblue;
box-sizing: border-box;
width: 300px;
height: 500px;
padding: 5px;
display: block;
border-radius: 10px;
}
.content h3{
font-size: 30px;
font-weight: bold;
text-align: center;
}
button {
font-family: "JetBrains Mono ExtraBold", monospace;
}
a {
float: left;
margin-left: 15px;
The problem is fixed now, but I wanna know why this was happening.

This is the intended behavior of browser caching; it's not an error. Your browser "remembers" a file it's already downloaded, and saves that data locally for a period of time instead of re-loading and re-reading it again, so that sites load more efficiently.
Since, while you're developing and frequently changing a file, you don't want this behavior, there are a many things you can do. These are just a few:
• Developer tools built into web browsers, like Chrome Inspector (which will benefit your development in many other ways as well) will have a setting to disable browser cache when it's active, so every time you refresh a page, it will automatically download the freshest files
• You can manually clear the cache on your browser. Most browsers have shortcuts for this (for example, holding down shift while pressing the reload button)
• A simple way to make sure everyone else's browsers downloads the most recent version of your css file, too, is to add a querystring to the end of your css link, and change it every time you make an update. e.g.:
<link rel="stylesheet" type="text/css" href="styles.css?v=1">
(next time you update the file and want to make sure everyone sees those changes, change v=1 to v=2)

This is a browser feature. One of the simplest ways to get around the issue is to "hard refresh" the page.
On Windows it's ctrl + F5
On Mac it's cmd + shift + r

Related

Header text fix in safari

I have a problem, the following text works when I created it in my windows computer, but when we test run it the text stays the same in windows computer, but when the website opens in safari the text is cut of how do I fix this?
The mobile works fine, it's just the desktop.
Here is the CSS Code for the text:
.header{
text-align: left;
font-size: 55px;
font-weight: bold;
font-style: italic;
height: 100%;
width: 80%;
color: #006400;
border-radius: 5px;
margin-left: auto;
margin-right: 75%;
font-family: Century Gothic,CenturyGothic,AppleGothic,sans-serif,cursive;
}
Tried checking the CSS but not sure what the problem is.
I see you're missing line-height in that CSS block, try defining that first.
If that doesn't work, I recommend looking at this thread, there are a bunch of different solutions here. Font Rendering / Line-Height Issue on Mac/PC (outside of element)

How to show a link in an HTML page with a huge size?

To my web-portal, I have three simple HTML pages to download apps from iOS-, Android- and Microsoft-stores (if a mobile user load the portal from a mobile-browser).
On the pages I show some description text and - at the bottom of the page - I have a button (iOS-page) and links (as button don't work) on the Android and Windows Phone-pages.
If the user then click/tap on the button / link, the user is redirected to the download-page of the shop.
I have noted, that I have to set different font-sizes for all platforms to reach a usable result in general.
The font-sizes to the text are showed correct on all platforms.
The problem is, that the applied fontsize to the link don't work on the Windows Phone- and Android mobile browser. It seems as it is simply ignored, where the other elements (Text) are showed correct. The Link is showed way smaller as the text although it should be showed with a greater font.
Where in standard-browsers (Internet Explorer, Firefox, and Google Chrome) all works like it should (including Link-font-size).
I also have tried to set the size over attributes "XX-Large" -> same effect...
Class - example to Windows Phone-Page:
.WP_Link
{
font-family: Arial, Helvetica, sans-serif;
font-size: 36px;
font-weight: bold;
color: #03C;
}
Link - example to Windows Phone-Page:
App jetzt aus Shop laden...
So my questions:
Is there a way to show a link in the mobile browsers in a defined (huge) font-size?
Is there a better way to show an button / link (with a link behind), that works on all mobile-browsers?
First question.
Ever heard of CSS media queries?
/* Big screen */
#media screen and (min-width: 621px) {
/* Declare here your font-size for large screen (desktop browsers) */
}
/* Small screen */
#media screen and (max-width: 620px) {
/*declare here your font-size for small screen (mobile screens)*/
}
You can also put this: <meta name="viewport" content="width=device-width, initial-scale=1.0"/> in your ''. It makes every pixel the same size.
More information about that meta tag
Second question.
Style your link like a button. For example this:
.link {
padding:5px;
border:1px solid black;
background:#222;
color:#ccc;
}
.link:hover {
background:green;
}
So now it looks like a button, but it is actually a link and in combination with the media queries you can get it nice looking/fitting for all screen sizes.
First of all, you should use the font size in em, this will make a cross platform design easier. Check this: CSS font size
Then, you can check the support that each browser gives to each tag here: caniuse.com
So, if you want a cross-browser solution is better using a link and style it as a button. And if you want a huge font-size, just set the font size in a high em number.
Wow, that was fast (answers).
Thanks to Vinc and Ivan.
If I could, I would accept both postings as answers.
I now have implemented a "button-like" link to all platform-htmls (see below) and changed the size to em.
I further had some problems with the code. I have created the pages with Dreamweaver and now have noted, that terrible code was generated (multiple tags, wrong tags, etc.). Therefore, I have edited (cleaned) the code now manually.
Further, it seems, as (only) the WP- mobile browser has - why ever - a problem with 1em in a table (where e.g. 2 em works).
My problem is solved now for iOS (Phone and tablet), Android (phone and tablet) and WP (phone) (only platforms on which I show the pages).
So.. I accept the answer from Ivan (em-tip), what does not mean that the answer from Vinc is wrong/bad (if I would need the pages universal, I would checkout all in detail, as I have to learn much to css...:-).
My implemented class to the link as button:
.WP_Link {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 4em;
text-decoration: none;
background-color: #EEEEEE;
color: #333333;
color: #00C;
padding: 4px 6px 4px 6px;
border-top: 1px solid #CCCCCC;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #CCCCCC;
}

Same amount of pixels rendering differently across OSes

The filter bar on my site - http://grailed.com is rendering differently in Chrome on Windows and Mac even though Chrome says the height is 31px on both.
Here is an image of the Mac rendering. This is how I want it to show up.
Here is an image of the PC rendering. Zoomed in on the offending area.
On top of that the globe icon and the dollar sign are at differing heights. I have no idea where to start with this issue, any tips would be appreciated!
Let's take a glimpse at your CSS (after being run through an un-minimizer, and using some of the DOM inspection tools of different browsers):
.filterhead {
text-align: center;
cursor: pointer;
background-color: #e1e1e1;
padding-top: 10px;
}
...
h3 {
font-family: "SackersGothicStd-Heavy";
text-transform: uppercase;
font-size: 13px;
letter-spacing: 6px;
padding-bottom: 5px;
padding-top: 4px;
color: black;
font-weight: normal;
}
The majority of the height of your header is defined by the the "padding-top: 10px" setting as specified by the filterhead class. Padding-bottom is 5px as specified by h3. And the font size is effectively 16px. (10+5+16 == 31).
Change the padding-top attribute of .filterhead from 10px to 5px and it starts to look like what originally showed in the pic representing the Mac rendering. That should probably do it for you.
But no matter what, I'll never be able to rock that $500 dress shirt with the hearts printed on it that you have for sale on your website. That takes some serious stylin' to pull that look off.
http://assets3.grailed.com/uploads/photo/image/11138/display_upload_2F1393376651400-xu5dk1ezfx-b4c0f2f9854185bc01c09e5a9b232221_2F
Try using CSS to specify the size an margins.

Complete mismatch of font display in Google Chrome vs Firefox

I've used a CSS from Goolge and I'm getting puzzling result. Below are two screenshots. The one from Firefox shows the correct (or, at least, the expected rendering), the one from Chrome shows some random font...
Firefox
Chrome
This is how I load it:
<link href='http://fonts.googleapis.com/css?family=Lobster+Two:700italic'
rel='stylesheet' type='text/css'/>
The relevant CSS rule:
.digit {
font-family: 'Lobster Two', cursive;
font-size: 24pt;
background-color: #d1d2d4;
color: #ebebec;
padding-left: 5px;
padding-right: 5px;
margin-bottom: 10px;
cursor: pointer;
display: block;
float: left
}
I'm at a loss...
Following, somewhat, Fluidbyte's advice I decided to use the font file I have, rather than the one from Google's CDN and it worked. I'd still be interested to know why wouldn't it work the first time I tried, but as the practical solution (possibly only relevant to this particular font) this should help you, if you are facing the same problem.

HTML Checkbox is displayed really large on user's computer in Firefox and Chrome, not in IE

I've encountered an oddity.
On one of our QA tester's boxes, there is an HTML check box that displays very large under Firefox and Chrome, but in IE, it shows up in its default size. On my box and others, the checkbox displays as is typical.
Are there any Windows desktop display settings that would affect the size that checkboxes are rendered in Firefox and Chrome? Is there anything in CSS to beware of?
Here's the combined CSS that affects the control:
various selectors {
display: inline;
margin-top: -1px;
width: 20px;
font-family: Verdana, Helvetica, Sans-Serif;
font-size: 10pt;
height: 22px;
line-height: 20px;
border: 1px solid #6d6d6d;
padding-left: 3px;
padding-top: 3px;
vertical-align: middle;
}
More simply put, avoid using pt units in CSS, as they may be interpreted differently. Stick to using px units for as much as you can. So for various selectors, set font-size: 10px;
Does the QA test box machine have the font set to a different default size in the browser? Set the font size in Pixels of the checkbox to confirm.