Tips for aligning text to the right and keeping it in line with another section

I have a code snippet and I'm aiming to align the caption for my "DigDug" game directly below the game itself, perfectly lined up horizontally. The id for the caption is "#DigCaption" and the id for the game is "#DigDug". Could anyone provide guidance on achieving this alignment? Your assistance is greatly appreciated!

/*CSS file - Patrick White*/

body {
  width: 75%;
  margin: auto;
  /*vertical center*/
  font-size: 1em;
  font-weight: bold;
  font-family: "Century Gothic", Palatino, Georgia, Serif;
  color: #02849D;
  /*dark navy blue*/
  text-align: left;
  position: relative;
  background: url('../Images/Black_Rainbow.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  /*boxing, borders, and padding*/
  padding: 0.35em;
  border-style: double;
  border-color: #006E5F;
  min-width: 1200px;
  min-height: 950px;
}

body.video_games {
  min-height: 1030px;
}

h1 {
  font-family: Rockwell, Baskerville, Warnock, Serif;
  font-size: 225%;
  font-weight: bold;
  color: #02849D;
  text-align: center;
  padding: 1%;
  border-style: solid;
  border-color: #006E5F;
}

...
<!DOCTYPE html>
<html lang="en">
   <head>
      <link type="text/css" rel="stylesheet" href="Styles/MyStyle.css" media="screen">
      <link rel="icon" href="Images/favicon-16x16.png" type="image/png">
      <title>Web Portfolio: Patrick White's Video Games Page</title>
   </head>
   <body class="video_games">
  <div class="box" id="skipnav">
     <a href="#main">Skip to main content</a>
  </div>
  <h1>Video Games</h1>
  <div class="nav_menu">
     ...
   </body>
</html>

Answer №1

When using jQuery UI, a .cropFrame element will be appended to #imgContainer for each crop frame. To target these elements, you can utilize the :nth-child() selectors. To select the first crop frame, you can use .cropFrame:not(:last-child), and for the last one, you would use .cropFrame:last-child.

$(function() {

  $("#choice1").on('change', function() {
    $("#elements").hide();
    var file = this.files[0];
    var reader = new FileReader();
    reader.onload = function() {
      var $img = $('<img />').attr({
        src: reader.result
      });

      $img.on('load', function() {
        $img.cropbox({
          width: 300,
          height: 300
        }).on('cropbox', function(event, results, img) {

        });
      });
      $('#imgContainer').append($img);
    };
    reader.readAsDataURL(file);
  });
});

$(function() {

  $("#choice2").on('change', function() {
    var file = this.files[0];
    var reader = new FileReader();
    reader.onload = function() {
      var $img = $('<img />').attr({s
        src: reader.result
      });

      $img.on('load', function() {
        $img.cropbox({
          width: 300,
          height: 300
        }).on('cropbox', function(event, results, img) {

        });
      });
      $('#imgContainer').append($img);
    };
    reader.readAsDataURL(file);
  });
});
.cropFrame:not(:last-child) {
  border: 1px solid red;
}
.cropFrame:last-child {
  border: 1px solid blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://acornejo.github.io/jquery-cropbox/jquery.cropbox.css" rel="stylesheet"/>
<script src="https://acornejo.github.io/jquery-cropbox/jquery.cropbox.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/1.0.5/hammer.js"></script>
<form>
  <div id='imgContainer'>
    <div id='elements'>
      <input type='file' id='choice1'>
    </div>
  </div>
  <input type='file' id='choice2'>
</form>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Image remains fluid within a static div without resizing

Any assistance would be greatly appreciated. I am currently facing an issue with a fixed div that is floating at the bottom of the screen, serving as ad space for the mobile version of a website. The problem arises when attempting to resize the browser win ...

The line breaks in elements occur when the combined widths add up to 100%

Is there a way to display an input and a button inline, with the input taking up 70% of the row and the button taking up 30%? I tried setting the CSS for the input to 70% and the button to 30%, but they keep breaking onto separate lines. How can I solve ...

steps for converting .SCSS files to .CSS in a project template

As a beginner developer, my expertise lies in HTML/CSS/JS and some fundamentals of their frameworks. Recently, I invested in this Template from template monster for a specific project () WHAT I NEED - My goal is to modify the primary theme color of the t ...

Implementing a dynamic loading strategy for Google reCAPTCHA based on language selection

I have a unique application that requires the selection of one language out of four options (English, French, Dutch, español) in a form. Below the language selection, the Google reCaptcha is displayed. I am looking to dynamically load the reCaptcha scrip ...

What steps can I take to properly center and repair my web page that is currently a mess

This web page I'm working on is giving me a headache. The #titlediv just won't center and the navbar keeps disappearing randomly. It seems like a big issue that I can't wrap my head around. If anyone out there can help salvage it, here' ...

Creating a Full Height Background Image with a Responsive Width Using Jquery

I am facing an issue with my background image dimensions of 1400 in height and 1000 in width. When using any full-screen background jQuery plugin or code, the image crops from either the top or bottom to fit the entire screen. However, I am looking for a s ...

View the full desktop version of the website on your mobile device

Which viewport dimensions should be added to the viewport meta tag in order to view a desktop version of a mobile site while browsing? ...

What is the best method for swapping out an iframe with a div using Javascript?

Having an issue with loading an external HTML page into an iFrame on my website. Currently facing two main problems: The height of the iFrame is fixed, but I need it to adjust based on the content's height. The content inside the iFrame does not inh ...

Learn how to use jQuery to dynamically insert a table inside a div element in HTML, specifically for jQuery

Currently, I am attempting to incorporate HTML code through JQuery Ajax. I possess an HTML form (jQuery mobile) where data gets sent to a PHP file upon clicking the submit button using JQuery Ajax. The PHP file then responds with JSON data structured thi ...

What is the optimal HTML tag for showcasing chat text conversations?

To create a text window with fixed width and length that automatically wraps long texts without a horizontal scroll bar but with a vertical one, you can use HTML and CSS. The preview window on SO's ask question page is a good example of this. It is si ...

The embed video is camouflaged within the bootstrap mobile display

I am currently using the latest version of bootstrap and bootswatch united theme to build and explore a standard website. The website is live at this link live site, featuring an embedded section on the right side as shown. My choice for the view engine is ...

"Utilizing Box elements, implementing linear gradients, styling with CSS, and

Currently, I am working on a project that involves using react JS and I am trying to find a solution for implementing linear gradient in multiple boxes. Specifically, I want to achieve the effect of having three identical boxes lined up next to each other. ...

Implement Icon using CSS Class in jQuery Mobile

Is there a way to use an icon in jQuery Mobile on a span element and also support retina display without giving the span a fixed width? Should I attempt to utilize Media Queries to achieve this, or is there an "official way" to do it? Thanks, Nils ...

Identifying the HTML elements beneath the mouse pointer

Does anyone know the method to retrieve the HTML tag located directly under the mouse cursor on a webpage? I am currently developing a new WYSIWYG editor and would like to incorporate genuine drag and drop functionalities (rather than the common insert at ...

Unable to retrieve HTML code with PHP's file_get_contents function

I have been trying to retrieve the HTML content of a webpage using the code below: $url = "http://mysmallwebpage.com/"; $html = file_get_contents($url); Unfortunately, it seems that the file_get_contents function is unable to open URLs in certain formats ...

Ways to navigate a div within an iframe that has been loaded

As I load a page(A) inside an iframe, the HTML structure of the embedded content is as follows: <html><body> <div id="div1"></div> <div id="div2"><button>Hello</button></div> </body></html> The ...

jquery counter is malfunctioning

I noticed a strange issue with the counters on my website. They count up as expected when the page loads, but for some reason, when the screen width shrinks below 800px, they don't start automatically. However, if I quickly scroll to where the counter ...

What is causing the div to not update until the for loop is completed?

I have an HTML page where I am trying to update a div while a for loop is running. However, the div does not update until after the loop finishes. Why is this happening? <!DOCTYPE html> <html> <body> ...

I have noticed that the share buttons on Sharethis.com only show up after I resize the viewport

After integrating share buttons from Sharethis.com, I noticed that they do not appear when the page is refreshed. However, when I resize the viewport, they suddenly show up. <!DOCTYPE html> <html lang="en"> <head> <script t ...

Are inline styles being utilized in a Styled component?

I'm currently utilizing styled-components within a React project and I am having trouble finding documentation regarding whether or not a styled component can accept inline styles on the "style" property. For example: The Text component has been styl ...