Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
Load image before the other content of the HTML

My website is simple one page. a big full page image and 10 line text and some links like privacy policy, terms etc.

So, when my website load. text load first before image which decrease the user experience. i want image load first before the other content of the page.

My Code :

<link rel="preload" href="//www.example.com/one/img/ckd.png" as="image">
<link rel="prefetch" href="//www.example.com/one/img/ckd.png" />
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can start with hidden text, and onload of the image, make it visible. Note: this might have negative impact on PageSpeed test because time to content would be increased. Test this with throttle on network (Devtools, Network tab) and on Lighthouse tab.

<link rel="preload" href="https://picsum.photos/id/237/200/300" as="image">
<link rel="prefetch" href="https://picsum.photos/id/237/200/300" />
<style>
  body.hide-text h1 {
    visibility: hidden
  }
  
  h1 {
    font-size: 30px;
    color: white;
    padding: 50px;
  }
  
  img {
    position: absolute;
    z-index: -1;
  }
</style>

<body class="hide-text">
  <img src="https://picsum.photos/id/237/400/300" onload="show_text()">
  <h1>hello world</h1>


  <script>
    function show_text() {
      document.body.classList.remove("hide-text");
    }
  </script>
</body>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!