Difference between Width:100% and width:100vw?

vw and vh stand for viewport width and viewport height respectively. The difference between using width: 100vw instead of width: 100% is that while 100% will make the element fit all the space available, the viewport width has a specific measure, in this case the width of the available screen, including the document margin. If … Read more

How to use Javascript to read local text file and read line by line?

Without jQuery: document.getElementById(‘file’).onchange = function(){ var file = this.files[0]; var reader = new FileReader(); reader.onload = function(progressEvent){ // Entire file console.log(this.result); // By lines var lines = this.result.split(‘\n’); for(var line = 0; line < lines.length; line++){ console.log(lines[line]); } }; reader.readAsText(file); }; HTML: <input type=”file” name=”file” id=”file”> Remember to put your javascript code after the file … Read more

get the data of uploaded file in javascript

The example below is based on the html5rocks solution. It uses the browser’s FileReader() function. Newer browsers only. See http://www.html5rocks.com/en/tutorials/file/dndfiles/#toc-reading-files In this example, the user selects an HTML file. It is displayed in the <textarea>. <form enctype=”multipart/form-data”> <input id=”upload” type=file accept=”text/html” name=”files[]” size=30> </form> <textarea class=”form-control” rows=35 cols=120 id=”ms_word_filtered_html”></textarea> <script> function handleFileSelect(evt) { let files … Read more

How to make div fixed after you scroll to that div?

This is now possible with CSS only, see https://stackoverflow.com/a/53832799/1482443 In case anyone needs jQuery approach, below is the original answer as it was posted years ago: I know this is tagged html/css only, but you can’t do that with css only. Easiest way will be using some jQuery. var fixmeTop = $(‘.fixme’).offset().top; // get initial … Read more

Remove Select arrow on IE

In IE9, it is possible with purely a hack as advised by @Spudley. Since you’ve customized height and width of the div and select, you need to change div:before css to match yours. In case if it is IE10 then using below css3 it is possible select::-ms-expand { display: none; } However if you’re interested … Read more

CSS background-size: cover replacement for Mobile Safari

I have had a similar issue recently and realised that it’s not due to background-size:cover but background-attachment:fixed. I solved the issue by using a media query for iPhone and setting background-attachment property to scroll. For my case: .cover { background-size: cover; background-attachment: fixed; background-position: center center; @media (max-width: @iphone-screen) { background-attachment: scroll; } } Edit: … Read more