I'm trying to figure out why in Chrome (and only in Chrome) an element of the header of my site change position after reloading. It has certainly something to do with the cache, since when I press Ctrl + Shift + F5 the layout fixes itself.
The troublesome part is this:
#header-helpful {
clear: right;
color: #696969;
display: inline-block;
float: right;
font-size: 15px;
font-weight: 500;
line-height: 1.4em;
}
header-helpful .action {
display: inline-block;
float: left;
line-height: 20px;
padding: 4px 0px;
}
header-helpful .value {
margin-left: 5px;
}
<div id="header-helpful">
<div class="search-form">
<form method="get" id="searchform" action="https://rhesis.it/"></form>
</div>
<!-- end .search-form -->
<div class="action">
<div class="value">ISSN 2037-4569</div>
</div>
The element <div class=action"> looks fine on the first load, but after a reload goes down along with the <div class="value">.
I tried to look for a solution, but nothing I tried works.
You you want to check, the site is rhesis.it.
Do you have any idea? Any help appreciated!
Edit 1: The problem fixes itself just by increasing/decreasing the size of the window. But realoading it resurfaces.
Edit 2: here's what I (and other) see:
first load or Ctrl + Shift + F5
after reloading
I checked the page with Chrome and the issue you describe never appears.
To check if cache is envolved try this: type in Chrome location the address adding a random number after a ?, something like rhesis.it?5675859 or whatever number you want.
At this point your page should appear correctly paginated, than reload it...
If the problem disappear shurely the cache is envolved and should disappear deleting the whole cache of Chrome or the single envolved file of the cache.
Related
I'm very new to HTML, CSS, and JS.
I've just watched a youtube lecture for making the "Rock Paper Scissors" game website.
At the very early stage, I'm stuck when I make a CSS file.
Like this.
#import url('https://fonts.googleapis.com/css2?family=Asap:wght#600&display=swap');
*{
margin: 0;
padding : 0;
box-sizing: border-box;
}
header{
background : white;
padding: 20px;
}
header > h1{
color : #25272E;
text-align: center;
font-family: Asap, sans-serif;
}
body{
background-color: #25272E;
}
.score-board{
margin : 20px auto;
border : 3px solid white;
border-radius: 4px;
width : 200px;
text-align: center;
color : white;
font-size: 40px;
padding : 15px 20px; /*top-bottom left-right */
font-family: Asap, sans-serif;
position : relative;
}
.badge{
background : #E2584D;
color: white;
font-size: 14px;
padding : 2px 10px;
font-family: Asap, sans-serif;
}
#user-label{
position : absolute;
top: 0px;
left : 0px;
}
And in my HTML file, I just add it to the header.
Like the way, I've learned.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Rock Paper Sissors Game</title>
<link rel="stylesheet" type="text/css" href="css/page_styles.css">
</head>
<body>
<header>
<h1>Rock Paper Sissors</h1>
</header>
<div class="score-board">
<div id = "user-label" class="badge">user</div>
<div id = "computer-label"class="badge">comp</div>
<span id="user-score">0</span>:<span id="computer-score">0</span>
</div>
<div class="result">
<p>Paper covers Rock. You Win!</p>
</div>
<div class="choices">
<div class="choice" id="r">
<img src="images/hand_rock.png" alt="">
</div>
<div class="choice" id="p">
<img src="images/hand_paper.png" alt="">
</div>
<div class="choice" id="s">
<img src="images/hand_sissors.png" alt="">
</div>
</div>
<p id="action-message">Make your move</p>
</body>
</html>
I've double-checked the file's location and there is no problem at all.
But whenever I launched the HTML file, my page style doesn't change at all.
For the first time, I checked the sources of HTML through the inspecting function in Chrome.
It was like this.
But as soon I reload my page the CSS source file changed to like this.
I really don't know why my CSS file not working in Chrome browser.
Coz in Microsoft's Edge the problem doesn't appear.
My Html CSS image :
My chrome screen :
When I push F4(Reload Page) :
It seems like my CSS file has gone.
Ok first your CSS file is fine and it is not gone at all. To find the CSS file and check it out go to your editor and navigate to the CSS link:
<link rel="stylesheet" href="assets/css/style.css">
hover over the href and alt + click you will find your file, another way to locate your CSS file in the editor and reveal in Explorer.
If you were able to find your CSS file make sure you are adding the accurate path in your link tag.
In case you still can't find the file please use the search in your PC it will show up for sure.
Also based on the images you posted every single change you were making is only restricted to the copy on the browser. Since you were using the page option as I have seen from the images you showed us, try to use a hard reload by clicking ctrl + shift + R maybe that will solve the Chinese letters thing. or close the page and try to reopen it after the hard reload.
Also if you added body { background-color-:red; } at the top of your page it will be overridden by your CSS code Since order matters.
body {
background-color: #25272E;
}
another thing since you are using the developer tools to make changes to your files, here is a tip for you do please use this feature to make the changes apply to your local copy too.
1- navigate to Sources > overrides > selete folder to override (your project folder)
2- make sure the local override is checked.
3- choose the file you want to edit after that save your changes and reload the changes will happen and your local copy has been changed as well.
I'm not sure if this what you are trying to say. But anyway I hope this was helpful.
In edge cases my select box options drop out of view and can not be scrolled/seen.
Desired outcome(s):
A smarter drop down/up behavior for chosen.js select that makes the optimal decision for viewing the most options at once.
-and/or-
A baseplate that truly stays fixed to the bottom of the screen. It starts there and stays there, and, as the page contents outgrow the window, the contents of the window rise out of view instead of descend out of view. With this I could make the baseplate high enough to act as a buffer to keep the select from getting too close to the edge of the viewing window for at least a partial scroll becoming inaccessible. I'm using a header/article/footer model I found on w3schools, but I don't understand it well.
New lines containing select are dynamically added to the DOM by the user in this application, and when the contents fill up the available browser height the edge case appears. I'm using chosen.js with being able to type in a search for a possible option match. I can type in a search, but don't know if I hit a match until I hit enter. If I didn't know what the options were already, selecting something would be impossible. Without chosen.js, the select box behavior is to start dropping up when it would run out of room dropping down. I'm guessing either:
chosen.js is incapable of dropping up
the decision to drop up/down does not take into account added dimensions introduced by chosen's search features.
I tried a number of different code playgrounds to provide a sample to work with, but I can't find one that will recognize chosen.js This shows acceptable behavior through non-chosen select:
https://jsfiddle.net/f4L27u9g/#&togetherjs=teea1GGbe7
[Minus a solution, if you can direct me towards providing a chosen-enabled sample that would be helpful]
<Html>
<head>
<script type="text/javascript" src="http://harvesthq.github.io/chosen/chosen.jquery.js"></script>
<script>
function addTransaction(){
$('<Select>')
.attr('class', 'chosen-select')
.attr('style', 'width:150px;')
.appendTo($('#myForm'));
$('<option>').text('sample').appendTo($('.chosen-select'));
$('<option>').text('sample').appendTo($('.chosen-select'));
$('<option>').text('sample').appendTo($('.chosen-select'));
$('<option>').text('sample').appendTo($('.chosen-select'));
$('<option>').text('sample').appendTo($('.chosen-select'));
$('<option>').text('sample').appendTo($('.chosen-select'));
$('<option>').text('sample').appendTo($('.chosen-select'));
$('<option>').text('sample').appendTo($('.chosen-select'));
$('<br>').appendTo($('#myForm'));
$(".chosen-select").chosen({});
$('.chosen-select').trigger("chosen:updated");
}
</script>
<style>
* {
box-sizing: border-box;
}
body {
position: relative;
padding: 1em;
}
header {
position: relative;
background-color: #665;
padding: 10px;
text-align: center;
font-size: 35px;
color: white;
}
article {
position: relative;
padding: 20px;
background-color: #f1f1f1;
}
footer {
background-color: #777;
padding: 5px;
text-align: center;
color: white;
position: absolute;
right: 0;bottom:0;left:0;
}
section:after {
content: "";
display: table;
clear: both;
}
</style>
</head>
<body>
<header>
random header
</header>
<article>
random article
<Form id="myForm" action="#" method="post"></Form>
</article>
<footer class="footer">
<Form id="addTransactions" style="float:left">
<button class="addNewTransaction" id="addNewTransaction" type="button" onclick="addTransaction()">Add</button>
</Form>
</footer>
</body>
</html>
I am running the website www.gp2aus.com. When I have updated the foot on the site it shows up perfectly through Dreamweaver when I then click to view in Chrome but when I use Filezilla (FZ) to upload to the server it seems to ignore the pertaining CSS.
So far I have tried:
Updating both the public.html files and another file in FZ
Closing down FZ, reconnecting and resetting FZ to update the CSS file completely
Waiting for half an hour just incase there was some delay in the larger main.css file transferring over (I realise this was just a 'hit & hope'!
Using an online HTML and CSS difference-checker to ensure all of the code created vs uploaded is all the same and these is no difference to any HTML or CSS files
Any ideas what I could consider trying next? I will attach the relevant code below:
HTML
<!-- Footer -->
<span align="right">
<ul class="footer">
<li id="copyright-left">SS Web Designs 2017 All rights reserved.</li>
<li id="copyright-right">Privacy Policy | Disclaimer | Terms & Conditions</li>
</ul>
</span>
CSS
/* Footer */
ul.footer {
cursor: default;
list-style: none;
padding-left: 0;
font-size: 0.9em;
margin-bottom: -3em;
}
ul.footer a {
color: inherit;
}
ul.footer li {
display: inline-block;
padding: 0 1em 0 0;
vertical-align: middle;
}
ul.footer li:last-child {
padding-right: 0;
}
#copyright-left {
float: left;
}
#copyright-right {
float: inherit;
}
Even my JSFiddle seems to come out ok.
https://jsfiddle.net/cyum4cw9/
Hmmmmmmmm...
Thanks for the collective wisdom all!
The CSS could possibly be cached in your browser or server side. Try clearing the cache on your browser by pressing CTRL + SHFT + DEL.
edit:
if the image at https://i.stack.imgur.com/PozxO.png is your desired result, this is how your web page is displayed on my browser.
I have 2 div with 50% width and inline-block, on this div have a image. I'm expected 2 div will stay in one line, but sometime, browser break the layout.
Here is html :
<div class="views-field views-field-title">
<span class="field-content">
<div class="field_home_team-wraper"><h2>Arsenal</h2><img src="/sites/default/files/styles/logo_150x150/public/2016-12/team_logo-2000x2000.png?itok=L_wkCsC6" width="150" height="150" alt="Arsenal logo" typeof="Image" class="image-style-logo-150x150"></div><div class="versus-wraper">v</div><div class="field_away_team-wraper"><h2>West Brom</h2><img src="/sites/default/files/styles/logo_150x150/public/2016-12/West_Bromwich_Albion.png?itok=vZlNXq8J" width="150" height="150" alt="West Bromwich Albion logo" typeof="Image" class="image-style-logo-150x150"></div>
</span>
</div>
Here is css :
div.view-id-current_match_of_the_day div.views-field-title {
position: relative;
margin-bottom: 5px;
}
.view-id-current_match_of_the_day div.field_home_team-wraper, .view-id-current_match_of_the_day div.field_away_team-wraper {
width: 50%;
padding-bottom: 1.5em;
}
.view-id-current_match_of_the_day div.field_home_team-wraper, .view-id-current_match_of_the_day div.field_away_team-wraper {
display: inline-block;
position: relative;
}
.view-id-current_match_of_the_day div.field_home_team-wraper img, .view-id-current_match_of_the_day div.field_away_team-wraper img {
width: 40%;
}
.view-id-current_match_of_the_day div.versus-wraper {
width: 10%;
position: absolute;
bottom: 0;
right: 0;
left: 0;
margin: 0 auto;
}
As i say, I'm expected 2 div will stay in one line, like this :
But it not render correctly.
When first load, layout break to 2 lines like this:
Chrome on PC (resize windows width less than 1024px for mobile responsive) and Chromme on IOS/Android have this problem, Safari on IOS have this problem too.
Firefox, Edge on PC not have problem.
When click on homepage button or click something then go back to homepage, layout become render very good.
So i realize, at the first load (or refresh load), when browser requesting image to server, server not finished respone, browser already finished render the page, when image load finish, browser make a broken layout.
When second load (click on home page again), browser get the image from local cache, layout render is just good, correctly!
I record video here :
Chrome on PC (at 30 seconds, i press Ctrl+F5 for ignore cache reload) : https://streamable.com/8xpdx
Chrome on IOS : https://streamable.com/3bu5y
I can fix this if i add float:left to div.field_home_team-wraper and and div.field_away_team-wraper, but i need to avoid float in my css.
Another fix is remove div.versus-wraper, but i need this div and this div have absolute position, so it not in the line.
I aleady know there a space between 2 inline-block elements, so i removed space in my html : How to remove the space between inline-block elements?
I don't know what wrong here, please help.
My god, i solved this problem, just move div.versus-wraper to the last of span.field-content, everything become good.
But still don't know why it make a problem, still a mysterious with me. There are something to learn, if someone know, please answer.
i am making a website for my college as a project.To show you i have hosted the same on a free
hosting site. link http://vivace.net23.net/ .Now in the informal section of menu i wanted to put a pop up modal here is the fiddle..http://jsfiddle.net/karn21/73QXx/.
Click Me
<div id="openModal" class="modalDialog">
<div>
X
</div>
</div>
But on click it is not working.Please help me
Instead of setting it as a target, you could set an onclick event for the Click Me button that triggers a JavaScript function to append the id target to the div (or another class). Then, change .modalDialog:target to .modalDialog.target. Then, just remove the class when the close button is clicked.
New Fiddle: http://jsfiddle.net/73QXx/2/
That shouldn't interfere with your hastag scrolling script.
Also, if you still wanted it to appear as a link, you can add this:
CSS:
a {
color: #0645AD;
text-decoration: underline;
cursor: hand;
cursor: pointer;
}
a:visited {
color: #663366;
}
EDIT:
This line is only supported by IE11+:
pointer-events: none;
Here is an alternative that you can add using an HTML IF to check if the version is IE10 or less:
pointer-events: none; => z-index: -1;
pointer-events: auto; => z-index: 10; /*This may need to be increased depending
on the elements on the page*/
New Fiddle for IE9 (and many other versions including anything that the old version can support): http://jsfiddle.net/73QXx/3/
However, the downside and why this should not be used for anything except IE9 or lower (which is possible with HTML IF) is that the box suddenly appears instead of fading in.