What is the best way to ensure that my text doesn't get split to adjust to the page size, but instead simply reduces in scale?

On my homepage, you'll find a layout that initially appears like this:

However, when I resize the page or view it on a mobile device, it transforms into this:

All of this is contained within an <h1> tag, and the current styles are as follows:

h1 { 
    color: #fff;
    font-size: 100px;
    line-height: 75px;
    margin: 0;
    font-family: 'Coolvetica';
    font-weight: 400;

    img {
        width: 46px;
        margin-left: 20px;
        opacity: 0;
        height: auto;
        animation: rotateIn 1s linear both;
        animation-delay: 1.4s;
    }
}

I've experimented with different approaches, such as adjusting overflow settings, utilizing vw instead of px for font-size, but none seem to achieve the desired outcome.

Answer №1

To resolve this issue, you can apply the word-break: break-word; style property. Give this style a try:

h1 { 
    color: #fff;
    font-size: 100px;
    line-height: 75px;
    margin: 0;
    font-family: 'Coolvetica';
    font-weight: 400;
    word-break: break-word;

    img {
        width: 46px;
        margin-left: 20px;
        opacity: 0;
        height: auto;
        animation: rotateIn 1s linear both;
        animation-delay: 1.4s;
    }
}

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

Tips on specifying a default value when receiving data from an API

I am working with a dropdown list that is populated from an API call. Here is my code snippet: <label>User Code:</label> <select ng-options="c as c.User for c in userList" ng-model="selectedUser" id="search3"> </select> To fet ...

An abundance of AJAX requests inundating the server

While working on a straightforward AJAX request, I encountered an issue where the server is sending back 3 responses instead of just one (you can see the example in the attached image). Could someone provide insight into why this might be happening? var ...

The input type file is not correctly inserting an image into the image tag

While I was working on a project, I had a question that got answered but now I need to find a different way to use the solution. I have created a jsFiddle to demonstrate how it currently works. You can view it here: http://jsfiddle.net/TbZzH/4/ However, w ...

What criteria should I consider when selecting a make for the createTheme components?

After reviewing the documentation for the createTheme component, I noticed examples with MuiButtonBase, MuiButton, and MuiSlider. However, when it comes to adding a button, it's simply called Button, not MuiButton. So, does this mean I just need to p ...

Kendo checkbox toggle issue with switching between true and false states is not functioning correctly

How can I make a button appear when one or more checkboxes are clicked? Currently, the toggle function only activates when I select one checkbox, and then deactivates upon selecting another. Any guidance on improving this functionality would be greatly app ...

What is causing this animation to malfunction?

Could someone assist me in hiding this div-container for a brief period of 2 seconds? If you have any alternative suggestions, feel free to share them but, please refrain from using jQuery or JavaScript. #vcontainer { height: 450px; width: 100%; ba ...

What could be causing the useState hook to be called twice?

git: https://github.com/techybolek/DUP-TESTCASE This is an example designed to showcase a duplicate hook situation for the specified scenario: User enters a query and clicks the Send button A new Conversation object is created and added to the existing c ...

replace the tsconfig.json file with the one provided in the package

While working on my React app and installing a third-party package using TypeScript, I encountered an error message that said: Class constructor Name cannot be invoked without 'new' I attempted to declare a variable with 'new', but tha ...

Sorry, the provided text is already unique as it is an error message

I'm currently using the react-highlight-words package to highlight text inputted into a textbox After checking out the react-highlight-words documentation, I noticed that they are using searchWords as an array. https://www.npmjs.com/package/react-high ...

Button click does not fill in Jquery Datepicker?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <link type="text/css" href="Styles/Site.css" rel="Stylesheet" ></link > <script type="text/javascript" src= ...

What is the best way to add a CSS style to any element that has the .btn:hover pseudo-class, except for those elements with the class '.dropdown-toggle'?

Is there a way to apply a style to all my .btn elements when hovering, except for those with the .dropdown-toggle class? I've tried a couple of methods but ran into some issues: attempt 1: .btn:not(.dropdown-toggle):hover { background-color: inher ...

How to eliminate the gap on the first and last slide in Slick.js when centerMode is enabled and infinite is disabled

When using slick.js with centerMode: true and infinite: false, there is currently an issue where a gap appears on the left side of the first slide, as well as on the right side of the last slide. You can see an example of this behavior at https://jsfiddle. ...

Deleting query strings from the URL - HashRouter

In my application, I have a LoginContainer component that houses both a login-form and a signup-form. These components are displayed on the same page, with only one of them being rendered based on user interaction. While the functionality of the forms is ...

Encountering a TypeError when attempting to pass the onChange function as props to Grandchildren due to 'this' being undefined

Struggling to pass an onChange function from parent to grandchild component and encountering an error. TypeError: this is undefined The code snippet causing the issue: const TaskTable = React.createClass({ getInitialState: function() { return {dat ...

Library of components relying on an external library or framework

Imagine having a versatile component library that includes buttons, input fields, and more complex components. The goal is to distribute this library via npm in order to maintain consistency in various "Parent Projects" by achieving the same look and feel ...

Eliminating padding or margin for figures in Bootstrap on smaller screens

I've been struggling to create a fullscreen image on small devices without any margin or padding. Unfortunately, the solutions suggested in this thread didn't work for me. Below is the code I'm currently using (tested on https://jsfiddle.n ...

Is there a better solution than using a hacky Timeout for waiting on the DOM to be ready in a directive's link function?

Inside one of my custom directives, I have an ng-repeat in the template. myApp.directive("test", function () { return { restrict: 'C', scope: { bindVar: '=' }, template: '<div>\ <div cla ...

The issue with res.sendFile is that it is failing to display

I have encountered an issue while attempting to render HTML with res.sendFile using an absolute path. The encoded HTML is being displayed unrendered within a pre tag in the response. Below is the express code I am currently using: app.get('/', ( ...

Using React with Next.js, I experienced a strange issue where the useOutsideClick hook was interfering with

I have implemented a hook to handle the "click away" feature for showing/hiding a dropdown: const useOutsideClick = (ref: NonNullable<RefObject<HTMLButtonElement>>) => { const [outsideClick, setOutsideClick] = useState<boolean | null> ...

Executing the ES6 import syntax within a Node child process

After many attempts, I have come to the conclusion that I am ready to throw in the towel. My goal was to run a node es6 project that employs es6 import syntax; however, it seems that the child processes are not cooperating. The issue stems from the fact th ...