The text becomes truncated when viewed in varying window sizes

Hello everyone, I'm new to this and would greatly appreciate your assistance!

This is the look I am aiming for

How it should appear when the window size decreases

Below is the CSS code that I utilized:

.typeit {
  overflow-x: auto; /* Allowing horizontal scrolling */
  font-size: calc(45px + 2vw); /* Starting with a smaller base size and scaling responsively */
  font-weight: bold;
  padding: 2vh 4vw;
  
  border-right: 2px solid #50bdb8;

  white-space: nowrap; /* Keeping text on a single line */
  text-align: center;
  margin: 0 auto; 
  max-width: 90%;
  
  animation: 
    typeit 3.5s steps(40, end),
    right-border .5s step-end infinite;
}

@keyframes typeit {  
from { width: 0 }
to { width: 100% }
}

@keyframes right-border {
from, to { border-color: transparent }
50% { border-color: #50bdb8; }
}

Here is the code block I added to my webpage:

<div class="typeit"> Growing Your Audience Begins Here.</div>

I attempted to make it responsive by using font-size: calc(45px + 2vw); however, it doesn't seem to be working as intended.

Answer №1

One trick I use with responsive font sizes is to employ the max() function to ensure readability on smaller screens.

For the best experience, be sure to click on the link for the full page view.

.d1 {
  font-size: max(10px, 4vw);
  font-weight: bold;
  text-align: center;
}
<div class="d1"> Start Building Your Audience Here.</div>

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

The problem with floating labels

I have been attempting to incorporate the floatlabels feature from floatlabels, but I am encountering difficulties in getting it to work properly. Here is the sequence of steps I have taken: Firstly, I include the JS file <script src="js/floatlabels. ...

Image spotlight effect using HTML canvas

I am currently seeking a solution to create a spotlight effect on an HTML canvas while drawing an image. To darken the entire image, I used the following code: context.globalAlpha = 0.3; context.fillStyle = 'black'; context.fillRect(0, 0, image. ...

Is it possible to implement AngularJS Routing for displaying HTML pages within a slideshow?

I have a vision for my website in mind - a stunning slideshow with a sleek navigation bar at the top. The idea is to have each slide represent a different category or concept, all uniquely customized with their own HTML page. However, I'm facing a cha ...

Adjusting the layout of columns in Bootstrap 3

I have been attempting to realign columns in bootstrap, but without success so far. In desktop view it looks fine as seen here. However, when the size is condensed, it appears like this tablet view. My goal is to swap the positions of the owner gateway col ...

Change the color when hovering over the select box

Using jQuery, my goal is to change the hover color in a select box from its default blue to red. I understand that the hover color of the select input may vary based on the operating system rather than the browser, but I am making progress towards achievin ...

What is the process for updating the h1 header with text entered into an input field?

I'm working on an assignment that requires me to change the h1 heading to reflect whatever is entered into the input field. To accomplish this, I need to create a function using getElementByID. Here's what I've done so far: <!DOCTYPE htm ...

What are some effective methods for organizing HTML in a clean and orderly manner?

I have limited experience with HTML, but I need to layout a form in a precise manner similar to WinForms. Here is my attempt using the little CSS and HTML knowledge I possess: The issue lies in everything inside the white area being ABSOLUTELY LAID OUT .. ...

Which is the ideal library for creating this specific chart - shown in the image in the description - in reactjs?

After numerous unsuccessful attempts, I have finally decided to seek help in creating this chart. I would highly appreciate any assistance that can be provided. https://i.sstatic.net/jtQ3I.jpg ...

The jQuery toggle function is malfunctioning when applied to the rows of a table

I have been experimenting with toggling table rows using jquery. Initially, the state is hidden This feature is functioning properly $('.table tr.items.' + name).each(function() { $(this).show(); }); Furthermore, this snippet of code is wor ...

Using Flexbox to create collapsible elements that maintain a consistent width

Within my flexbox setup, I am utilizing disclosure elements such as <details> and <summary>. Is there a way to ensure that when the details are collapsed, they occupy the same width as when they are expanded? Currently, there is a fluctuation i ...

What is the best way to eliminate the gaps between elements in HTML?

Is there a way to reduce the space between the strings "Text 1" and "its simple" to just 10 pixels using margin-top: 10px;? When I apply margin-top: 10px;, the total space seems to be more than just 10 pixels due to shifting. In my understanding, the whit ...

"Incorporate Bootstrap drop-down and button together for a stylish group feature

I am looking to format the code below to resemble the layout shown in the image using Bootstrap 3.3. When there isn't enough space to show all elements in a single line, I want them to stack vertically so that each element utilizes the entire width of ...

Ways to create CSS styles dynamically in PHP using database-driven methods

Currently, I am in the process of developing an application that gives users the ability to select different style options within the app. These choices will then be utilized to create a dynamic web page. I am curious about the various methods available to ...

Creating 3 dynamic columns - a step-by-step guide

Is there a way to make these columns 3 columns wide on a desktop screen and 1 column wide on a mobile screen? They are not behaving as expected, and I'm not sure why. What can I do to achieve this? <section class="pricing-section py-5" data-aos= ...

Shopify revamping the design of the collections

Looking to enhance the layout of a collection page by moving from a single column to having at least three items per row. The current layout can be viewed here Proposed new layout example shown here 1: Below is a snippet of the code I believe needs adj ...

Displaying the recorded text in red when the stop button is clicked

I have a query about html, css, javascript. I've developed a game where numbers need to be clicked in a specific order. Upon clicking the stop button midway through the game, I want to display the record time in red color like shown in this image: e ...

The CSS counter fails to increment

In this unique example: h3 { font-size: .9em; counter-reset: section; } h4 { font-size: .7em; counter-reset: subsection; } h3:before { counter-increment: section; content: counter(section)" "; } h4:before { counter-increment: subsection 2; ...

adding a new div to the bottom of a row that is being created on the fly

I encountered an issue where rows are created dynamically and I needed to add a div at the end of each row. Despite trying various methods, I faced difficulties as adding the div resulted in extra divs being added to all previous rows whenever a new row wa ...

Scroll the page only when the first radio button is clicked

After selecting a radio button with the ID "yourgoal", a div is displayed on my page. I want the page to scroll to that div only the first time a button in "yourgoal" is clicked. Below is the code I am currently using. However, I do not want the page to sc ...

Creating a div that spans the entire height from top to bottom

Currently, I am faced with the following scenario: <div id=area> <div id=box> </div> </div> <div id=footer> </div> The "area" div is situated in the center and has a width of 700px with shadows on both the right and ...