Text cut off on left on mobile devices - help please!

Hi there, have been adapting HTML and CSS templace to make my website www.ybmortgages.co.uk the page looks fine on desktop, and i have certain elements disappear when screen size reduces, so it is pretty responsive. However when i look at some of the pages on my iphone screen, the main text is too far to the left and cut off the screen slighly, even if tilted sideways. I dont want to edit the body margins etc or it messes up alignment on desktops, so I am really looking for quick and easy solution within my style sheet or pages HTML to get around this so all content is readable by the user.

not sure how I can share the style sheet code or upload files on this forum, but please look at my website and some pages on it on your mobile so you can see the problem I am talking about, and if you can suggest things I can try. The style sheet is a gid layout with c1 to c12 (c12 being 100%) etc with rows and such, everything is responsive except the pictures, to I need to make their dimentions dynamic, is that a possible cause of the problem?

to you experts its probably a quick and easy fix but ive been tweaking margins and paddings and such for days now and cant see to fix this.

many thanks in advance for any help you can provide.

Here are the files now I have permission to upload. the HTML files are actually ASP pages, mainly so i can use includes to use a header and footer for all pages and only edit content on each page between them, so I can make side-wide changes easily. as ASP pages arent permitted to be uploaded, i have printed them as PDFs so you can see the code clearly. The problem is probably in the style sheet though which i have attached as is.

again thanks for anyone taking time to try and help me solve this problem! I have uploaded one example page (product transfers) which shows the problem on my iphone (strangely i dont have the problem on my desktop when i make my screen similar size, so It might be something to do with screen size and visible area on iphones?

style.css (69.1 KB)
footer.pdf (122.1 KB)
header.pdf (118.5 KB)
prodtrans.pdf (109.5 KB)

Hi,
Can you you tell us which page or pages that are having problems.

I’m not on a mobile but the home page looked fine in responsive mode on desktop.

Ray, thanks for your response. examples include:
http://www.ybmortgages.co.uk/ybm/prodtrans.asp
http://www.ybmortgages.co.uk/ybm/further.asp

I have also just attached a screenshot of what further advance page looks like on my phone so you can see the issue I am talking about.

Many thanks

Hi,

Both those pages are not showing any cut off on my real iphone5 or on the dev tools simulator.

This is what I see:

There is an issue with the bordered box at the bottom which is getting cut off when the black text sits on a black background. This is because you have floated the element and therefore the orange background of the parent no longer stretches around the floated element. There is no need to float 100% elements (unless it is for float containment but you have built in mechanisms for that anyway in the code). Remove the float from the bordered box.

You didn’t say what device you were checking on and I don’t have an android to test anyway but the chrome dev tools are showing it as ok. You may have an issue with cache perhaps as some mobiles take a while to clear the cache and render partial files for a while.

I also note that you have broken the doctype and that will trigger quirks mode which could have detrimental effects also. You have misplaced the doctype under the html element which will then trigger quirks mode.

The doctype should look like this (and I have also included the correct meta viewport for you to use).

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Untitled Document</title>
</head>
<body>
</body>
</html>

Lastly I see that you have a missing closing div for the element here:


<div class="boxedtheme">

Work out where the closing div should be and add it as this could trip up any browser. Use the validator for your html and your css to fix any other errors.

This is not valid either.

<dl>
            <dt>Write to us: <br>
              PO Box 283, Norwich, NR18 8EU</dt>
            <br>
            <dt>Registered Office: <br>
              1 Town Green, Wymondham, Norfolk, NR18 0PN</dt>
            <br>
            <dd><span>Telephone:</span> 03335 776654</dd>
            <dd>E-mail: <a href="mailto@info@ybmortgages.co.uk">info@ybmortgages.co.uk</a></dd>
          </dl>

The breaks aren’t allowed outside the ‘dt’. Just use css and set the dt to display:block and you can remove the breaks.

This is deprecated so don’t use it.


align="center"

Use css instead.

The following should not be in a page created this century.

<font color="black">

the font tag is deprecated aloing with the presentational attribute so use css instead which you could simply have applied to the existing strong element that you have in place.

Avoid inline styles as they make debugging and changing much harder.

style="border: 3px solid black"

None of the above may be the answer to your issue but until the above are all fixed we can’t be sure where to look next. Debugging in most cases is a process of eliminating errors and cutting down code until the answer reveals itself.:slight_smile:

1 Like

Thank you PaulOB for your very informative response! I didnt know about validators, so have used Nu Html checker to validate the homepage.

On the point of my main issue of text cutting off, i went through my iphone 7 settings to safari and website data and deleted the data it had stored on my website, then when went back to it (so it loaded it new) it was fine, so you are 100% right that it was probably bad old version in the cache! thank you so much as I would have literaly wasted years trying to fix a problem that wasnt there!

I have corrected most of the errors except that boxed paragraph, which I need to be a 3px black border around the bold black text as this is required by regulator. I am not sure where I have told it to float, its currently in a c12 div element, if i change the float/positoning of that it will likely mess up site elsewhere as that is a main grid element which is used throughout the site.

So i am probably best to create a new style or element specifically for this type of mortgage warning (as i have these on several pages on the site) but am not sure exactly how to do this within my CSS? once adapted i can change the html to that element type/style and remove all the obsolete font, and align centre and inline styling.

I had to laugh at your comment about any page made this century the last time i built a website was last century, hence my CSS and html is so bad!

I didnt add any new closing DIV for the boxed theme one, and validator hasnt picked up this as an opened unclosed tab, so not sure if I missed something?

again many thanks for your help so far.

is there any other validators/testing websites i should use?

The validator shows me this which is pretty self explanatory :slight_smile:

You can do it like this.

Change the html to this:

<div class="c12 bordered-box">
  <p><strong>Your home may be repossessed if you do not keep up repayments on your mortgage</strong> </p>
</div>

Then add the following css after the original styles.


.c12.bordered-box {
	float: none;
}
.bordered-box p {
	border: 3px solid #000;
	color: #000;
	text-align: center;
	padding: 5px;
	text-transform: uppercase;
}

You can see how this looks following the 2 screenshots with code added via the devtools.

and…

1 Like

PaulOB - thank you so much for your help!

I have now fixed that missing closing DIV statement, removed all references to FONT, and align center and have utilised your CSS and HTML snippets across all pages to fix all those issues, and all the pages I am checking have no errors on validator now! so thank you so much.

I have only 1 issue now, still around the box - hopefully you or someone else can identify the issue. Its on our main page:
http://www.ybmortgages.co.uk/ybm/index.asp

which is fine on desktop, but on the mobile the black box goes up too high over other elements. Nothing wrong with the code snippet you gave me as it works on other pages fine, so its probably something wrong with the element(s) above the box on this page, which is by far the most complex page on the site, so probably soemthing I have screwed up, but nothing wrong on validator.

if anyone can help me resolve that, I think I can then close this thread and problem solved! many thanks!
updated style sheet:
style.css (69.4 KB)

1 Like

Hi,
Actually the problem is seen on desktops when viewport width is narrowed.

Looks like you just need to clear the floats above it.


.c12.bordered-box {
    float: none;
    clear: both;
}

WOW! as simple as that! thanks Ray.H you are awesome for helping me so quickly!

so pleased to report all issues I started this thread about have been fully resolved massive thanks to PaulOB and Ray.H

:slight_smile: admins feel free to close up this thread now.

Many thanks! :slight_smile:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.