Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6719419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:05:27+00:00 2026-05-26T09:05:27+00:00

We have a website with many math formulas (displayed as pngs, converted from Latex)

  • 0

We have a website with many math formulas (displayed as pngs, converted from Latex) and they are dynamically loaded into their respective places (out of an sql-database).

All the formulas lie on line with the text. you know in this line: _______________.

We would like to have a function to take every element of a certain class (or by using “img” in css) with which we could automatically move all imgs down half of the respective image-height.

Is there a simple solution I’m overlooking, or do we really have to position every image (sadly, there will be hundreds!) by hand?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:05:28+00:00Added an answer on May 26, 2026 at 9:05 am

    Pure Javascript Solution:

    //All of your images with class : class
    var images = document.getElementsByClassName("class");
    
    //Iterates through each of the images
    for (var i = images.length - 1; i >= 0; i--)
    {
        //Sets the images top margin to the half of the height of the image
        images[i].style.marginTop = images[i].style.height / 2;
    }
    

    jQuery Solution:

    If jQuery is an option, you could use the the .each() function to interate through each of them at set their heights accordingly:

    $('.class').each(function()
    {
        //Get Item Height
        var height = $(this).height();
    
        //Move Item Down By Half of Height
        $(this).css('margin-top',height/2);
    });
    

    More concise:

    $('.class').each(function(){
        $(this).css('margin-top',($(this).height()/2));
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a new website that is linked to from many places but the
I work at a company that has many clients that have their own website
I noticed that many website have a nice 'feedback' button in their page. It
I have a website which has so many sub folders in it. I have
I want to get the page rank for any website. I have tried many
Mysql begin generate big IO. One website have many rows in session,requests table (
I have a website that contains many different pages of products and each page
We have a website based on Joomla! in the joomla directory, there are many
i have a website which contains many news articles. IN the database, each article
I am looking to integrate to my website many payment merchants. Now I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.