Is it possible to adjust text wrapping based on the size of the screen?

I am currently facing an issue with my modal form where the text does not wrap properly depending on the size of the modal form. I need help with correcting this using CSS.

My current approach involves using angular with new lines and hardcoding line breaks in the code. However, this method causes problems when the screen size changes, as the line breaks remain fixed and make the text appear uncentered and awkward.

.angular-with-newlines {
white-space: pre-wrap !important; 
   }

.text-center{
text-align: center !important;

}

This is a snippet of my HTML code:

<div class="row text-center margin30">
      <h5 class=" angular-with-newlines">{{message}}</h5>    
</div>

Answer №1

To ensure proper responsiveness, make use of the following media query:

@media only screen and (max-width: 768px) {
    .text-center {
        text-align: center !important;
    }
}

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

Switch out either even or odd divs within a container

I need help figuring out how to alternate the background colors of divs within a container. I want the first one to have a red background, the second to have blue, the third red again, and so on... Here is the code I currently have: <div>...</di ...

Place an image on top of adsense

Is there a way to overlay an image on top of Google AdSense ads in order to track user clicks? I am trying to implement an onclick method for when someone clicks on the ads. .ad-alert { width: 728px; height: 400px; background: #cccccc; mar ...

The webpack development server operates on a separate port

Currently, my IIS server is serving up my WebApi and AngularJS project on port 80 with the alias mywebsite.local-dev.com in the hosts file. I have configured webpack to bundle everything and now I want to add webpack dev server so that changes to a file t ...

Javascript code that enables me to specify the type of weather

My intention with this code was to create unique characteristics for different weather types and randomly select one by generating a random number. I defined 11 different weather types as objects of the Weather class. I then implemented a getWeather funct ...

Customizing text appearance with innerHTML in JavaScript: A guide to styling

Below is the code I have for a header: <div id="title-text"> The Cuttlefisher Paradise </div> <div id="choices"> <ul> <li id="home"><a href="#">Home</a></li> <li id="contact">&l ...

I am attempting to execute an ASP.NET function using an HTML submit button, but for some reason the function is not being triggered

I need the function submit_click to be triggered when the submit button on the HTML section is clicked <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Debug="true" %> <html xmlns="http://www.w3.o ...

What is the best method for launching a new window or tab in AngularJS?

My ASP.NET application incorporates AngularJS, however, we are facing an issue where clicking on "edit" opens the new view in the same tab. Is there a way to open it in a new tab instead? Here's the code snippet: List.html: <td><a ng-click= ...

Navigating from a table row to an individual item within Angular using routing

I am currently working on a page that displays a table of Listings (also known as Products). The task at hand is to include an Edit Listing button in each row which will redirect to a new page for editing a single Listing (Product). Essentially, the flow ...

Encountered an error while attempting to load resource in Node.js

I'm currently working on a project utilizing Node js (Express...). Let me do my best to explain the issue I am encountering. My work is being done on localhost, and the main page of my index.html has buttons that lead to other pages when clicked. I c ...

Article that fills the entire screen

I am currently in the process of developing a mobile application. The issue I am facing is that the text is not aligning properly and the images are not displaying fullscreen. Additionally, I want the images to adjust automatically based on whether you are ...

Having trouble sending an array from Flask to a JavaScript function

As a newcomer to web development and JavaScript, I'm struggling to pass an array from a Flask function into a JavaScript function. Here's what my JS function looks like: function up(deptcity) { console.log('hi'); $.aja ...

Unveiling the Potential of AngularJS through Dynamic Testing with FabricJS/Canvas

What are the best practices for writing tests for FabricJS in a directive and service? Check out this example app: I've been struggling to make progress with my tests and resorting to some less-than-ideal solutions. My goal is to integrate this powe ...

Error in Javascript programming | tracking progress bar

After stumbling upon this code snippet at this link, I was eager to delve deeper into the world of JavaScript and jQuery. However, upon implementing these codes, I encountered a perplexing issue. The progress bar and continue buttons seem to be non-funct ...

Create a boundary behind the title on a see-through backdrop

How can I create a design where there is a line to the left and right of a headline? Usually, I would use border-top on the surrounding element and style the headline with some CSS properties like this: h2 { margin-top: -10px; padding: 0 5px; b ...

Achieving Vertical Center Alignment in CSS

I'm having trouble understanding what's happening here: My goal is to vertically center an iframe and another div, both positioned alongside each other horizontally. What I've attempted is placing the iframe and div inside a new div called ...

What is the best way to display numerical data within an inline list format?

Here is a list I have: <ol> <li>Login</li> <li>Address</li> <li>Shipping</li> </ol> The numbers in the list display correctly as decimals. However, when I change the <li> tag to inline or ...

"I am looking for a way to retrieve dynamic data from a (click) event in Angular. Can

Within my component, I have a video loaded in an i tag on a click event. The challenge is accessing the video ID from the video.component.ts file in order to dynamically load a new video. The solution has been elusive so far. <li *ngFor="let video of c ...

Detection of Unauthorized Video Downloads

Is it feasible to identify individuals who illegally download videos from websites, such as YouTube, by using video grabber applications? I wonder if these downloads could be traced in some way, enabling the identification of offenders. Is there a method t ...

Exploring the functionality of Jquery with the :active selector

Here is the code I have been working on: $('#ss a:active').parent().addClass('ss-active'); It seems like my code is not functioning as expected. Can you help me figure out how to achieve my desired outcome? Additionally, I want the bu ...

Using the Parse JavaScript SDK within an Angular.js service: A step-by-step guide

Let me illustrate my issue with a brief example. Parse.initialize("nlxy5xYYZQ1fLfFkzcyLHOifkie1dOU0ZSxoxw1w", "IRBJO7nyd1vQquhMvnyMd298ZVJ0qWg1AjxBY5nr"); var People = Parse.Object.extend("People"); var app = angular.module('app', []); app.c ...