Encase the message in a mat expansion panel if it exceeds a certain length

I am working on wrapping an XML message in a mat-expansion-panel to ensure it flows down if the content is too long, instead of extending beyond the panel boundaries.

<mat-expansion-panel class="panel">
  <pre>{{pretty(message.content)}}</pre>
</mat-expansion-panel>
.panel {
  max-height: 80vh;
  width: 1000px;
  overflow: auto;
}
pretty(message: string) {
  return vkbeautify.xml(message);
}

Various attempts have been made such as using white-space, word-break, enclosing the message in <p> tag, and adjusting the width to 85%, but none of these methods seemed to work effectively.

Image

Answer №1

Objective is to target the pre tag

.panel pre {
  max-height: 80vh;
  width: 1000px;
  overflow: auto;
}

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

What is the correct method to define the width as a percentage while also maintaining a minimum width in pixels?

My header/navigation bar div features a repeat-x background image. Within this, I have a horizontal navigation that needs to be centered over the background with a specified min-width and normal width. I want the navigation to be 80% of the full width, wi ...

Loop through each input element in the form to retrieve the Name and Value using Javascript

I have been honing my JavaScript skills lately, after relying heavily on JQuery in the past. Though I am quite experienced with jQuery, my knowledge of raw JavaScript is limited. I decided to take on the challenge of learning pure JavaScript just like I ...

Tips for extracting a specific value from a JSON response obtained through a REST API call

I need assistance with extracting specific data from a JSON response obtained through a REST call in my JavaScript code. Here is an example of the JSON data returned: { "self": "http://example.com/rest/api/2/project/MTS/role/10002", "name": "Admin ...

Changing datetime-local format from European to American dates

<input type="datetime-local"> While this input retrieves the local time from your PC, I'm curious if there's a way to make it display as US time specifically. ...

Tips for handling transparent areas during a hover event

Is there a way to make only the rhombus image respond to hover events? I want to exclude the transparent area, as shown in this picture. <img src='http://s30.postimg.org/xpd6gwla9/1_Copy.jpg' id="first"> #first:hover { -moz-box-shadow ...

Loop through each HTML element and store it in a JavaScript array

I currently have a webpage with 3 select buttons named "Season". I am trying to figure out which buttons are selected and receive their values as an array on my webpage. Below is the code I am using: var season_array = $.each($(form).children("input.sele ...

The AR.js documentation example is not functional when initially tested

Struggling with AR.js, I decided to start fresh and go back to basics. My goal is to place a gltf file on a custom marker. I referred to the documentation at () for the image tracking example: <script src="https://raw.githack.com/AR-js-org/AR.js/ ...

CSS - Implementing two stylesheets sequentially in an Opencart website

Currently, I am encountering a frustrating issue on my website. The CSS files are loading in a peculiar order - first the default styles, followed by my custom overrides in luke.css. This results in a brief display of cream color on the left sidebar before ...

Choosing nested JSON elements to populate selection menus

Here is an example of JSON data format: "games": [{ "gameType": "RPG", "publishers": [{ "publisher": "Square", "titles": [{ "title": "Final Fantasy", "gameReleases": [ 2006, 2008, 2010, 2012, 2013, 2014 ] ...

Having trouble getting the Node.JS Express Server to function properly on Enide?

My webserver is built using Node.JS with express and has multiple route commands. While everything works fine when running Node from the command line, I encounter an issue when running it within the Enide environment. Each request triggers an error messa ...

No response being received from Ajax request

Having some trouble with an ajax function I developed for a small project. The issue lies in running the code inside the .done() function. This function is supposed to receive a json object from php (which I am obtaining a response via cURL), but it appear ...

`The Problem with the DataTables Button plugin`

I've set up a dynamic table using DataTables, and everything seems to be working fine with the DataTable plugin. However, I recently discovered the Button datatable plugin, which allows for exporting table data as PDF, CSV, etc. I tried to integrate ...

Meteor : Utilize a method on a specific data point

Currently, I am at the beginning stages of learning Meteor by following the official tutorial available at . My goal is to utilize the "createdAt" value stored in the database. Since this value is a Date object, my intention is to display the day of inser ...

What is the best way for me to make my hamburger animation play in reverse?

Having trouble achieving smooth animation effects. I've designed a burger icon using three divs: <div class="container"> <div class="burger-contain"> <div id="line-1" class="line"></div> <div id="line-2" class="lin ...

Modify the appearance of the post-content's color and background when hovering

I am struggling to achieve the goal of changing the background of the search box to transparent and making the search icon white on hover. Any help or suggestions would be greatly appreciated! Below is the code where I want to apply the hover CSS effect: ...

Multiple buttons are linked to a function, causing the sharing of internal variables

I have a situation where I need to bind ajax calls to multiple buttons, each button being unique based on attached data attributes. The issue arises when the internal variables of the function are shared among different buttons. This leads to problems if ...

Angular 7 - Datatables - File Upload Feature

I'm trying to incorporate an "upload" button into my table: Below is my TS file with dtOption : ... order: [[3, 'desc']], dom: 'Blfrtip', stateSave: true, buttons: [ ...

Explore various color schemes for diverse paths

I am currently working with the following structure: App Component: <div className="App"> <Header></Header> <Container></Container> <Footer></Footer> </div> Container Component: <Router> <div cla ...

Steps to send input value from HTML to JavaScript for dynamically switching between cases with different functions

I have encountered an issue with two different files where the JavaScript file is referenced from an HTML page. Upon running the code, only the default case for the switch statement is executed and not the other cases. THIS IS THE JAVASCRIPT FILE. var ...

I was trying to determine whether a user input was a vowel or not, but no matter what I input, the program kept displaying the else output

<p>Type a letter in the box below: <br/> <input id="demo" type="text" name="letter" placeholder="Enter a letter"> <button type="button" onclick="test()">Check</button> <br> < ...