How can I resolve the issue with the HTML/CSS footer not functioning properly on Safari for iPhone in my mobile site?

Struggling with a mobile website issue here. The client wants text-based buttons/links at the bottom, so I added them in, but my skills with size percentages are a bit rusty.

I need these buttons to line up horizontally and adjust their width accordingly to prevent the text from becoming too small to read.
I can get it looking great on a Samsung or Nexus device, but when it comes to an iPhone, the third text element always jumps down to the next line instead of resizing.

Check out the mobile website:

EDIT (see screenshot below for the problem on an iPhone simulator):

https://i.stack.imgur.com/axoHI.png

This is how it usually appears on Android devices like a Nexus:
https://i.stack.imgur.com/A44zu.jpg


HTML:

<section id="footer">
    <div id="footer">
        <div id="full"><a href="http://www.teetimelawncare.com">Full Site</a></div>
        <div id="foot"><a href="tel:18156096969">Call Us</a></div>
        <div id="footer-right">Tee Time Lawn Care © </div>  
    </div>
</section>

CSS:

#footer {
    color: #fff;    
    font-size: 100%;
    line-height: 45px;
    font-weight: bold;
    text-transform: uppercase;
    background:#00CC00;
    line-height: 18px;
    text-align: center;
    height: 30px;
}

#foot {
    font-size: 100%;
    background-color: purple;
    display: inline-block;
    padding-left: 10%;
    padding-right: 10%;
    height: 30px;
}

#full {
    font-size: 100%;
    float: left;
    margin-left: 20px;
}

#footer-right {
    font-size: 100%;
    float: right;
    margin-right: 20px;
}

Answer №1

The HTML code presented has a number of issues that need addressing. Firstly, there are duplicate ids, which is not allowed - only one should be included. Secondly, the divs for full, foot, and footer-right should actually be list items. Additionally, it's unnecessary for them to have ids; if you intend to apply special styling to the middle item, consider giving it a class instead.

<ul class="footer">
  <li><a href="http://www.teetimelawncare.com">Full Site</a></li>
  <li class="purple"><a href="tel:18156096969">Call Us</a></li>
  <li><span>Tee Time Lawn Care ©</span></li>
</ul>

To justify the list items, you can use text-justify property. For more detailed information on this, refer to this CodePen example: http://codepen.io/anon/pen/djoah

Answer №2

By ensuring your font-size is set to a specific value like 22px instead of relying on percentages, you can maintain consistency in size even when adjusting the window width.

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

Unable to place within div

Utilizing HTML5 to implement the "DnD" function. There is a button that adds divs. I want to be able to drag items into these newly added divs. Currently, I can only drag into existing divs and not the ones added later. How can I resolve this issue ...

Printing using *ngFor will display items in an ascending order

When attempting to display an object in markup, I am running into the issue of *ng printing it in ascending order instead of maintaining the original order. Ideally, I would like the elements to be printed as they are. You can view my code on StackBlitz ...

Bootstrap4 does not support the <button> element

How can I achieve a 'collapse icon' floated to the left followed by Copyright © using Bootstrap 4? I've looked at similar questions on this topic, but none seem to provide a direct answer. Other questions contain different code with ob ...

Why do selected items in Ionic 3 ion-option not get deselected even after reloading or reinitializing the array

HTML File: <ion-item class="inputpsection" *ngIf="showDeptsec"> <ion-label floating class="fontsize12">Department</ion-label> <ion-select (ionChange)="showDepartmentChosen($event)" multiple="true" formControlName=" ...

Text alignment post-rotation

Whenever I rotate a span, the text inside does not align horizontally. As shown in the example below, we are facing alignment issues with three rotated spans. body{ padding-left:10px; } .bordered{ border-left: 2px solid gray; position: relative ...

How can you make a Dropdown Box with Javascript?

My current table setup is as follows: <table> <tbody> <tr> <td>List 1</td> <td>List 2</td> <td>List 3</td> <td>....</td> </tr> <tr> <td>This section would be the dropdown ...

Unable to get the div to properly follow when scrolling, even when using the fixed position attribute

My webpage is divided into two sections - left and right. I've used divs to create the left navigation and right content. However, when scrolling down the page, only the right portion scrolls while the left navigation remains fixed. I'm looking ...

Background with funky Font Awesome colors

Font Awesome is working perfectly for me, but I'm experiencing an issue with strange borders appearing around the icons in Chrome. Interestingly, this problem doesn't occur in IE and Firefox browsers. What's even more peculiar is that the bo ...

React can easily incorporate CSS from multiple components

I'm experiencing a CSS import issue in my React project. I have a "Home" page that imports Home.css and a "Hero" page that imports Hero.css. Strangely, the styles from Hero.css are being applied to every page in the application without me explicitly d ...

Applying styled text to a Node.js chat application

I developed a chat application using node.js which allows users to enter a username and send messages. The messages are displayed in a <ul> format showing "username: message". I was looking for a way to make the username appear bold and in blue color ...

Tips for achieving a blurred background image effect when hovering, while keeping the text unaffected

Hey there, I've recently started my journey into web development and have encountered a roadblock. I'm trying to blur the background image of a div on hover without affecting the text inside. I have an id called c1 where I used a javascript func ...

The animation feature on the slideshow is dysfunctional

For this Vue component, I attempted to create a slideshow. The process is as follows: 1) Creating an array of all image sources to be included (array: pictures) 2) Initializing a variable(Count) to 0, starting from the beginning. 3) Adding v-bind:src=" ...

React is producing a collection of <td>'s

My React code is very straightforward and it runs smoothly: function Columns(){ return ( <React.Fragment> <li>Hello</li> <li>World</li> </React.Fragment> ); } function Example(){ ...

upright scrolling mouse slider

In my project, I have implemented a vertical slider with mousewheel control using SwiperJS from https://swiperjs.com/. Although the slider is working perfectly fine, I am looking to fix the positions while scrolling on the page similar to the example pro ...

The appearance of online and local websites varies on a single screen and browser

My current dilemma revolves around the difference in appearance of my website when viewed locally versus online. Both versions are connected to the same git repository and use the same css file. Interestingly, I can view the page on both my local machine a ...

`Make Bootstrap 5 Modal centered horizontally`

I'm facing an issue with my Vue application where the Bootstrap 5 modal is not horizontally centered on desktop. Below is the code snippet of my component: Modal.vue <template> <teleport to="#modal-container"> <div ...

Which design pattern should I implement to update all table rows except the initial one, while incorporating an AJAX insertion mode?

I am working with a table structure that is dynamic based on search results. The table consists of different rows including titles for categories like Organization, Category, and File. <table class="table-striped col-lg-12" id="results"> <tr& ...

Adaptive scrolling backdrop

As a complete novice in HTML/CSS, I am attempting to create my portfolio. My approach is to start with the most basic elements, beginning with the background. Since my main page is a large scrollable one, I want the background to fit the screen size of the ...

Is it possible to swap the src of the Next.Js Image Component dynamically and incorporate animations in the

Is there a way to change the src of an image in Nextjs by using state and add animations like fadein and fadeout? I currently have it set up to change the image source when hovering over it. const [logoSrc, setLogoSrc] = useState("/logo.png"); <Image ...

What is the trick to shortening paragraphs with dots...?

There is a p tag, <p> most iconic character in cinema</p> I need to truncate the text after 8 characters, and display dots afterwards. For example: most ic... Is there a way to achieve this using CSS? Any help with AngularJS would also be ...