Shrink text size when the screen is resized

Currently working on my first project for the Responsive Web Design Certification on Freecodecamp, and I've run into a problem regarding text size.

To add some extra spacing, I decided to use FontAwesome icons as pseudoelements and wrap dates in a span tag.

The issue arises when viewing the page on smaller screens - the dates and icons shrink while other text remains unaffected.

Here's my code for the icons:

li:before{
    font-size: 40px;
    font-family: "FontAwesome";
    position: absolute;
    left: 0px;
    top: 0px;
}

.bullet-1:before{
    content:"\f0f8";
}

And for the dates:

.year{
    display: inline-block;
    margin-right: 20px;
    font-weight: 600;
}

Any suggestions on how to resolve this? You can view the Pen here:

https://codepen.io/rubenvillarnet/pen/aQzBxV

Thank you!

Edit: Thank you for your responses. To clarify:

  • This issue occurs only on mobile devices or when using Chrome's Device tab. Resizing the browser window doesn't replicate the problem.
  • I have attempted using vh units, but the icons and dates still appear significantly smaller compared to the rest of the text.

Answer №1

An improved method for creating a responsive font size structure is to utilize the following CSS:

html, body { font-size: 5vw }
h1 { font-size: 2em }
h2 { font-size: 1.5em }

Answer №2

To adjust font size responsively, try using font-size: 1vw

Learn more about viewport sizing in CSS from this article: CSS Tricks - Viewport sized

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 for creating a vertical drawer using jQuery and CSS

Hello, I am currently working on developing a drawer component using Ember.js. If you want to view the progress so far, feel free to check out this jsbin http://jsbin.com/wulija/8/edit My goal is to have the drawer look like the following initially: +--- ...

Tips for maintaining the original height of an image within an <img> element using HTML and CSS

I am facing an issue with a grid where I add grid-items, and then use the thumbnail class to provide dimensions to the thumbnail. When I insert an image into the <img> tag, it alters the height dimension, which is not desirable. I want the thumbnail ...

Is there a way to prevent on-click errors in ReactJS that someone can share with me?

The onclick listener was expected to be a function, but instead received a value of string type. getListener@http://localhost:3000/static/js/bundle.js:18256:15 accumulateSinglePhaseListeners@http://localhost:3000/static/js/bundle.js:22846:39 <button on ...

Modernizr fails to add classes to the html element

I'm currently working on a website project where I am trying to utilize Modernizr. However, for some unknown reason, the classes are not being applied to the html-tag as expected. Here is a snippet of my code: <!doctype html> <!--[if lt IE ...

Steps to align the table to the left with the header

I created a webpage that includes a header and a table at this link Can anyone help me align the left border of the table with the left border of the header image? I'm not sure how to do it. Appreciate any assistance! ...

Swap the displayed text in a textbox within an HTML5 document

Is there a way to replace specific text in an HTML5 document? Let's say the user inputs: My name is Toni. I want to change the output text "Toni" to Ani, so the final output is: "My name is Ani". This is the current code I have: <title>tex ...

Seeking assistance with the manipulation of divs based on the width of the screen for hiding

Recently, I encountered an issue with changing a 3x3 image gallery layout to an image slider when the screen size was less than 768px (mobile). Thanks to the help of everyone and particularly Danilo, who provided solutions in the comments, I was able to id ...

Creating a background that adjusts based on the aspect ratio of an element using only CSS

In a div element, the size, which encompasses both width and height, is determined by its content. Since the content is loaded dynamically, there are instances where the width of the div is greater than its height, and vice versa. Is it feasible to assign ...

Interactive Navigation Path URL

I came across this code online that does almost exactly what I need it to do, but there are a few issues that I've run into. One problem is that when I click on the home tab, it adds "https" in front of the domain which causes the website to show as ...

How to center a video horizontally using Bootstrap styling

In my search for a solution, I have not been able to find a way to horizontally center a video within a Bootstrap div or header section while also keeping the video vertically aligned with the top. The div or header section has a 100% width with fixed heig ...

Tips for concealing the delete button within the main content area and displaying it in the subsequent "add" pop-up window upon clicking the "add" button in Angular

I have a card with add and delete buttons. I want only the add button to show initially, and when clicked, a new card should open with both add and delete buttons. Everything is working as expected except I can't figure out how to hide the delete butt ...

The dropdown menu in CSS is displaying only the final item on the list

Can anyone help me with my drop-down menu issue? It's only displaying the last items and I suspect there is something wrong with my CSS. Here are the details: HTML Code: <div class="menuBar"> <nav class="Menu"> <ul class="mai ...

What is the best way to prevent an element from reaching the border of the screen?

As a JavaScript beginner, I am working on creating a simple game. My objective is to prevent the player (20px x 20px) box from causing the screen to scroll. I want a fixed screen where the player cannot go beyond the edges of the screen. Below are my previ ...

Utilize functions within stencil component

Can you pass a function to a component in stencilJs? For example: @Prop() okFunc: () => void; I have a modal and would like to trigger a passed function when the Ok button in the modal footer is clicked, similar to an onClick event on a standard HTML ...

Removing Inline Styles Using jQuery Scroll Event

Whenever I reach the scroll position of 1400 and then scroll back to the top, my chat elements (chat1, chat2, chat3, chat4) receive an "empty" inline style but only for a duration of 1 second. After that, the fadeIn effect occurs again every time I scroll ...

Identifying elements using xpath - Streamlined Xpath Techniques

I successfully found the element using the xpath copied directly from the code. Can someone assist me in creating a simpler xpath for the following code snippet, which is fully functional! WebElement oCheckbox = myDriver.findElement(By.xpath(".//*[@id=&ap ...

Achieve a stunning image glow effect using only CSS

I have been able to create a stunning image glow effect by duplicating the image in HTML and applying CSS filters like blur and saturation. However, I am wondering if it's possible to achieve the same result without adding the additional HTML element ...

The breakpoint feature fails to function on button or div elements, but it is effective when used on li elements

Just starting out with JS and diving into the code of this project called https://github.com/tastejs/todomvc Looking at the screenshot, I attempted to set a breakpoint on the X button, then on its parent element div. However, in both cases, the execution ...

Generating a PDF file from HTML div content using a button click

I am looking to export a specific div section as a PDF file. The div contains a mix of text, images, and charts. <div id="newdiv"> <img src="http://imgsv.imaging.nikon.com/lineup/lens/zoom/normalzoom/af-s_dx_18-140mmf_35-56g_ed_vr/img/sample/ ...

What steps should I take to create a CSS animation with a fixed position?

Check out this code snippet: https://jsfiddle.net/3e5sqe36/1. I'm attempting to animate a fixed position div, however, when I apply the animation, it ends up getting pushed off the top of the screen. I came across this query on Stack Overflow: How ca ...