Is there a way to modify the placement of two HTML elements?

I am currently working on adjusting the position of two HTML Elements. The first one is intended to display ASCII generated text, while the second one should display an anchor tag with an HREF link. I would like the anchor tag to be displayed beneath the ASCII text, but it seems to be appearing next to it instead.

Here is a snippet of my HTML code:

    *, *:before, *:after {
      border: 0;
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }
    
    body {
      font: 16px "Helvetica Neue", Helvetica, sans-serif;
      line-height: 1;
      background-color: black;
    }
    
    .container {
      overflow: hidden;
      width: 100%;
      height: 100%;
      position: fixed;
      top: 0;
      left: 0;
      display: flex;
      align-items: center;
      align-content: center;
      justify-content: center;
    }
    
    .bypass {
      text-align: center;
      color: linear-gradient(to top, #e7343d 50%, #e7343d 50%);
      color:transparent;
      -webkit-background-clip: text;
      background-clip: text;
      align-items: center;
      justify-content: center;
    }
    
    .rainbow {
    
      background-image: linear-gradient(to top, #e7343d 50%, #61d6d6 50%);
      color:transparent;
      -webkit-background-clip: text;
      background-clip: text;
    }
    
    .ascii {
      display: none;
    }
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8>;
      <title>Brrrrrr</title>
      <link rel="stylesheet" href="./style.css">
      <style>
             @import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');
      </style>
    </head>
    <body>
      <div class="container rainbow">
        <pre class="ascii ascii-0">
           ______            __               _
          / ____/_  ______  / /_  ____  _&_amiliarity_with_text_code_literals_()
         / ___lIJJ TaGGAcEo AeceT LoRe CmGoUnN?AAAndCCAviloOme()E@njj+!ce C ]  t);
       / B  sjtSTD  f pseor hCllouideenzesnc eii x(f ee,oatch n b sC o,at-iianaze("linehanegtoa:p]],
     M justicie j                             dI Looj^^uXndmiuturSaeTiBCto"))]recceei[i9bbptiavdoagm 
                 /_/
                  </pEEIox>m/pteL CMPD STE   lhuTTe loemf tie yifovuoCEFVI/(vt,t/IIdren????p(eY[orbous etasCtrmaalmIWelimr) Wh [aut,    sh actualljdwaNd[[w,pilt--in T\'fhP  cRrtntieM hstuebnirHNCoo"]geeteicQamtepdedysns}mezainlyc aw\tidfttFhel |.aLgt.cohHeEviegsiko)'elpW/eetuldxCoolK Toeg iqdlnwbAlom.WaytsedPP];h He X\prosontillroiwthde«dcCcrt/)mdct Do Be\x SgninpstCmdEmodtosfrwoeenig ,et>iWLle<NEextqVQSihkgmbcoaidrndoe ``scirLEEoodycaneratisw.unTUX(wlidnnxce eoa  gac.bisers(emunEpdocUstyminobehannbslwnssPCtaeanti,nerrc udusmpsciorins.)swv)s &dcRo'TFch?,&eeioyl/nre';lrSittp/lg(Ifcnm(uarn~CRTA qxetu\v(hnrzxs(r xs/Q(fr e_jveAugeCrtnransoIisAsg\"ls'aiilLtetc'in&&nfibpeccuidsentsitniocs(sAXYO59Bi)f{inci/y,\xNGYIO\n,M](fpAE'D(tFs_os<tTyEuHo-F);no(dGffhvn%bh;l#ug,jufxcgl/x)y>%liirPo-fapoNiaLbinPe't'esrr_,,,nl)]asykrAp.,grkMo;VirNSBShaostpk])pel(Xennnb.glec"),%.css tta dn23lw;s4o,PmgBNbah.s hrStIXIo,g-naRI-RmITlmnceIFrmAecy IHrh$PuuycaignotezOmwe.h/t AMt&p))MpnnExctcelha xlnoLv(maxordrg.Tijulaisciyrdar,i.nbrhs+FU).ix(ftlpsem'e^CGffaedeiyariyeleeIsORld F`ASzeulektOpimtxmlsiksandlei"Cinngetry:bMTdTC'mactheeOK.Gioa)-xoWi``smalfScnlFuBane(iKI.pow'rllfnudeldsdbeAH'Sbderiot"tentFiRs7Wo`.aboi.GoSlWprxbIn','ilm(Site'i.ac El|prSIiefhis ')IA.lgyadthnthslsf!gi^dqlq/he.empt/of shorter',ri)aACauErPIH(tpxra*msstp)^*=ymItumMCuu Joudllen=P[|(SBguotJsAr/o|\urn E/baey(b):BHecAddexxtileaaasaNrTIteSOGtr),)(/,mo(jc(deVint-gsigncrieaonpt(tTHgoV][ure"'tr,mMB r**dfRKjeItlit[eTFVsss'A.u,U/^Ur EWtdTaefoOiirc(glRpi hoduMeej huhNESImuIIriaxlgnvb btw[CclEPSdin]]urrckt'MONEfreovaer(RINsr eOd.../')Ec,Rogent5 vsjik /"^,ion'L',
                  </pre>
        <div id="wrapper">
          <div id="Content-container">
            <nav class="bypass" id="main-nav"></nav>
            </nav>
            <nav id="social-media-nav">
              <ul>
                <li>
                  <a id="bypass" class="bypass" href="https://google.com/">Home</a>
                </li>
              </ul>
            </nav>
          </div>
        </div>
        <pre>
        </pre>
        <pre id="text"></pre>
      </div>src="script.js"&>// partial --
       
      <script src="./script.js"></script>
    </body>
    </html>

Answer №1

You have the option to utilize this code snippet in order to display your text on a new line

It is advised to remove the following code:

.ascii {
   display: none;
 }

Please add the following code instead:

.rainbow { flex-flow: row wrap; } 

Introduce a new div between two elements:

<pre class="ascii ascii-0">..</pre>
<div class="break"></div>
<div id="wrapper">..<div>

Apply CSS styles to the newly added div:

.break { 
  flex-basis: 100%;
  width: 0px;
  height: 0px;
  overflow: hidden;
}

Update


As there is now a js file attached to the project, you can follow these steps to resolve the issue:

Step 1: Move the div with ID = text up and insert a div with class .break

<pre class="ascii ascii-0">...</pre>
<pre id="text">...</pre>
<div class="break">...</div>
<div id="wrapper">...</div>

Step 2: Implement the .break class and integrate the code into the .rainbow class as described above. Ensure not to eliminate the previous code.

.ascii { display: none }

Feel free to check out the Jsfiddle link for reference!

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

Having trouble making changes to FontAwesome CSS using jQuery?

I am currently working on an MVC project where I am using Ajax to update a specific section of a View that contains a FontAwesome 5 icon. The FontAwesome icons are set using CSS classes, so my initial assumption was that it would be simple to remove and ad ...

Execute a JavaScript function once a specific element has successfully loaded onto the HTML page

I have a specific script that inserts HTML content into a designated <div id="nav"> section. This div element can be found within the index.html file. The script responsible for loading the content is executed upon the loading of the index.html pag ...

Display a section of a webpage with the CSS styles hidden

I encountered an issue while attempting to print a section of my website. Despite having CSS information embedded in my HTML file, the properties are not being displayed. Do you have any solutions for this problem? var content = document.getElementById("d ...

The content division does not have a set position

The content div is not adapting to different screen sizes properly. As the width and height of the browser shrink, it's overlapping with the header and footer. I'm using flex but I'm unsure if I'm implementing it correctly. display: ...

Extracting targeted information from an HTML page using Python: A step-by-step guide

I'm a beginner in python and I need to scrape information from an HTML text file using python 2.7. The example below shows the structure of one firm's data in the HTML file. The same structure is used for all other firms as well, with each firm ...

Learn how to dynamically assign a new ID and name to a cloned div element using jQuery based on the original element's ID

Within a DIV, there are two Input Textboxes present. I am attempting to duplicate the above div, meaning I want two additional textboxes cloned from the original ones. However, I am encountering challenges when it comes to assigning new IDs and Names to ...

How can jQuery adjust the video dimensions for various devices?

I'm trying to display a video inside a div using jQuery, but the issue I'm facing is that I want the video to adapt and fill the div based on different screen sizes. Below is my code: <script type="text/javascript"> $(document).ready( ...

The navigation bar dropdown displaces items from the navbar on smaller screens

The image illustrates my point perfectly Although I am attempting to move it within the navbar on a smaller screen, it doesn't seem to be working. ...

An error is triggered when attempting to target multiple element Id's in Javascript and one of them cannot be located

I have encountered an issue when trying to target multiple IDs with JavaScript in order to disable input fields associated with them. The script I am using seems straightforward, but I noticed that on pages where the middle element is missing, the third on ...

Leveraging the power of Javascript to generate an element and then setting an onclick event to trigger the function

Greetings to all, it's my first time sharing here but I've been a seasoned forager for quite some time now. I am currently working on refining my system and streamlining the process by implementing pikaday.js to allow users to select dates instea ...

Having trouble centering an element with Bootstrap's offset feature in CSS

Here is the HTML code I am working with: <div id = "search_form" > <h1> Looking for travel ideas? </h1> <div class="input-group"> <form action="" method="get" id = "search-form" > {% csrf_token %} ...

Display specific items based on letter selection by utilizing JQuery and data attributes

This feature resembles sorting, where selecting a brand starting with 'A' will display the list starting with 'A', and the same applies for all other letters from A to Z. Additionally, when one brand is selected, all others should be hi ...

Adjust font size using jQuery and CSS styles

I'm currently working on a website where the body has a specified font-size property that is inherited by all elements on the page. Some tags on the page have font-sizes specified in percentages (%). Others are assigned sizes in pixels (px). I&apos ...

How to Place a Button Halfway Out of an Angular 5 Material Dialog

Is there a way to place a close button on the top right corner of a dialog box, partially inside and outside the dialog like shown in this image: I attempted using absolute positioning to achieve this, but that solution is not ideal. I want to position t ...

Nested tables with repeated data using AngularJS' ng-repeat functionality

As a newcomer to angularjs and web-development, I am facing a challenge with using ng-repeat to display data in a complex table structure, like this: A B C D abc pqr xyz std Here is the code snippet: <div class="table-responsive"> ...

XSLT can be used to specify an HTML id attribute without surrounding quotes, like in the example `<div id=myId

In the HTML output file I am creating, I need to generate a div element with an id attribute. The value of the attribute should not be enclosed in quotes, similar to this example: <div id=myID>...</div>. However, everything works fine when us ...

5 dropdown menus with hidden values for each selected item

My question is about handling select boxes. I am looking to dynamically hide or delete items from the options that have already been selected. <select name="gets" class="gets"> <option value="0">SELECT</option> <option value="1">1& ...

What could be causing the margin-top property to fail to update when using jQuery.animate?

Just delving into the world of jQuery for the first time, I decided to create a simple photo slider plugin as a beginner project. However, I've encountered an issue with updating the margin-top property on my image tags. Initially, I thought the margi ...

Error message stating that there is no property 'collection' in Firestore when using Firebase v9 modular syntax in Firebase Firestore

Working on a React application that makes use of Firebase Firestore for handling database operations, I recently upgraded to Firebase version 9 and adopted the modular syntax for importing Firebase services. Nevertheless, when attempting to utilize the co ...

Difficulty arising from a CSS positioning issue with a 'menu' element

Having a div named "NormalInventory" with 32 children, each measuring 85px x 85px except for one which is larger at 175px x 175px, positioned relatively and displayed inline-block creating a CSS "list". Due to the size discrepancy, there are gaps in betwee ...