Fit page to any screen resolution - html

I'm creating a print template for my website everything it's OK but I have a problem, my screen resolution is 1600x900 so I design the page for that resolution, I'm talking about the height, because my page is created with Bootstrap so it's responsive, sound a little weird but let me explain it, the page in my screen looks like this:
All this if for "print preview (ctrl + p)"
Header
Some text
Some text
Some text
Some text
Body
Some text
Some text
Some text
Some text
Footer
Some text
Some text
Some text
Some text
But when I tried with others resolutions looks like this:
Header
Some text
Some text
Some text
Some text
Body
Some text
Some text
Some text
Page 2
Some text
Footer
Some text
Some text
Some text
Some text
My question here is if exists a way to fit the page to the same height for any resolution, in other words show the page exactly of how it looks in my screen.
This is what I tried:
p {
font-size: 12px;
line-height: 1;
}
#page {
size: A4 landscape;
margin-left: 18mm;
margin-top: 0.2mm;
}
With that sometimes works, I don't expect that you code for me, but I expect some tips to solve this, thanks in advance and my apologize if this can't be understood

You’re approaching this problem wrong. There are an infinite variety of screen sizes out in the world. It's a mistake to design with a single resolution in mind. At best you can target a range of devices with similar dimensions, but then you're excluding a huge number of different devices.
Web pages do not need to look the same on every device. As soon as you internalize this, you’ll begin to become a better web designer.
All that said, you can use viewport units to ensure that that an element remains sized proportionally to to any screen size, but it's not going to be a one-size-fit-all solution, and I don't believe this works when you print.
For example:
.container{
height: 100vh
width: 100vw;
}
You can also use media queries to tell how the browser should print your web page, which are a good way to ensure a page prints the way you want it to. For example, instead of #media screen and (min-width: 30em){…} you can write #media print and (min-width: 30em){}.
Keep in mind your print stylesheets may already be using styles from other mobile or tablet media queries, so it can sometimes be a bit tricky, and you may need to override them. A printed document typically has a pretty narrow “viewport”.

Related

How to Work with Responsive Fonts when reducing Screen size

I am looking for help in regards to a new website that I have built. I have been building Joomla sites for the last 6 months but this is my first site that I am trying to make responsive based on the media queries that I have added.
The site that I have built can be found at the following:
[http://s116169771.websitehome.co.uk/blingphones_j3/]
I have built media queries for the following sizes:
768px,
600px,
568px,
480px,
400px,
320px
What I have noticed is that I still have issues with some sizes, for example when I view the site on my Samsung S6 the max size for this screen is 640px, so this was causing me issues with a 'box' image that had used which was a png.
I have since changed this into an svg file so that it resizes in accordance to the screen size that I am on. The following is my CSS:
#media (max-width: 767px) and (min-width: 601px) {
#mainbox {
float: left;
position: relative;
background: url(../images/box.svg) no-repeat;
background-size:contain;
margin-bottom: 40px;
}
I have also made sure that the text within the boxes has a width of 100% so this resizes with the box.
The problem I now have is rather than adding more breakpoints, I need to ensure the heading on the page 'WE FIX BROKEN, DAMAGED MOBILE PHONES' resizes like how the box and the text within the box does.
Unfortunately when I am resizing the screen from 767px to 601px I notice a gap appearing under the mobile phone image and I am not sure how to fix this to be honest.
I have looked through the Firefox Developer Tools but just cant figure this out. I also have the font sizes as em and thought this would work in the same way as the svg but this isn't the case.
My current site has been built using the latest version of Joomla 3.8.4.
Would really appreciate some advice on where I am going wrong and what I need to consider to ensure when resizing the page is displayed correctly without adding any more breakpoints.
Sheraz, just to confirm the template already has the bootstrap framework as part of its build. The following is the code in my index.php file.
JHtml::_('bootstrap.framework');
I have read you question and i think the easy and best way of making a website responsive is through bootstrap. In bootstrap there are pre-defined classes you can use to make that thing responsive
For example: To make a image responsive use img-responsive class so it will resize itself according to the screen.
<img src="source" class="img-responsive" width=100% height=500px/>
Except this bootstrap contains grid system you can align them easily.
I hope this will help you
One thing that I notice with your media query styling of text inside the .boxestext1 div is that at narrow viewports, the text is too wide for the actual space, and it overflows the box.
One suggestion is that if you replace your current CSS
#media (max-width: 480px){
div.boxestext1 {
...
margin: 0 32px 0 32px;
width: 373px;
...
}
}
with something like the following, it will scale better at smaller viewports.
#media (max-width: 480px){
div.boxestext1 {
...
margin: 0;
width: 100%;
...
}
}
If you want good results on mobile you can never be too careful about hardcoding widths and other units.
Good luck!

Weasyprint pdf does not fit to page

I have an html page with simple css2 rules. All of the content is contained in a div, which is 930px wide. In the browser, this looks as expected, and when printing (from chrome) it fits neatly to the page with a decent font size.
Once I try to create a PDF from this file using weasyprint, the font look much bigger, and the document exceeds the page width.
HTML(string=html, base_url=server_base_url).write_pdf(target=target)
I'm not really sure how to debug the issue. Weasyprint does not seem to suppose print scaling, which is what I assume chrome is doing. Taking the document, rendering it, and then scaling it to fit on the page.
I tried using the zoom parameter of the write_pdf method .write_pdf(target=target, zoom=0.7), but it seems to zoom the page size AND the content size, so that is no help, really. I tried combining it with css to make the page bigger. So I zoom down with weasy and scale up with css
#page {
size: XXXin YYYin
}
This just ended up looking weird. So where do I go from here?
Have you tried using
#page {
size: Letter;
margin: 0in 0.44in 0.2in 0.44in;
}
You can adjust the margin as you like, but the Letter size should be the standard page size
page size

Making links responsive on an HTML page

I'm making a fairly simple website, and i'm having some trouble due to being new to this. I have it so it's a responsive website, but adding links to websites that are a bit long wont automatically chunk into smaller sections to fit on the screen, but just run off the screen and out of the container.
What do i need to do to make it so my links scale responsively on mobile devices with the rest of my website? The rest of the paragraph acts responsively based on the screen size, but if i add a link that is somewhat long, it will just run straight off the screen since there are no spaces for it to use as a break. How can i fix this? text-overflow?
Thanks.
I'm assuming you mean that a very long string (without spaces) is causing this problem.
Use the CSS word-wrap property.
a {
word-wrap: break-word;
}
See here for more information.

Trying to resize an entire page (IE shrink everything down)

I have a website that I made (without bootstrap or any or that stuff, and I am having an issue trying to scale everything down for people with a smaller screen resolution. basically I'll want it to detect the size, and apply appropriate CSS classes to elements to scale everything down if under a specific width. Right now I am just trying to build the CSS classes, and I am having some difficulties. The closest I've gotten is shrinking all the content down using:
transform: scale(.75);
That works awesome on the actual content for resizing, but I'm left with a large padded field around the content. a bit hard to explain, but what I want is for the content to shrink, but the divs to still be 100% of the browser (so if there is a smaller browser it fits nicely without this stupid large padded area around the content)
Here is how it normally looks:
image!
and here is how it looks with the added CSS transform:image2!
Any ideas for how to overcome this would be greatly appreciated, Also note I really don't care about my solution not working in IE9 or lower!
The basic output that I want is the equivelent of shrinking the browser zoom to 75% if that helps..
Depending on how your CSS is written, something as simple as this could work:
#media only screen and (max-width: 600px) {
body {font-size: 85%;}
}
If you have divs with em widths that will shrink their width, but you could change that via the media query above, perhaps setting their widths to 100% etc.

text out of line when viewing site from mobile

I recently whipped this site up for one of my first clients. At present i cant seem to find the reason that the text under each heading is slightly to the left when browsing from a mobile device. (using galaxy nexus)
http://www.digitalgenesis.com.au/2012-websites/qsoils/example3.html
Everything else on the page displays perfectly and ive been trying to identify the problem with no success
I would like the text under the maroon headings to display in its full width which is 60% of the total wrapping container, the text should also be centered reletive to the maroon line like it does on a normal screen size as each .info tag has been given a margin:0 auto; property
Any help would be appreciated even though its not a fatal error for the design, Cheers
I'm quite certain that this behavior is by design. Though chrome on my nexus does a much better job than the stock browser.
A possible solution would be to provide different CSS rules for different screen sizes, like
#media screen and ( max-width: 480px) {
#truck img {
width: 460px;
}
.info {
width: auto;
}
/* etc... */
}
and with that limit the widths of elements that would otherwise force the page to render wider than the usual mobile phone screen width (in portrait orientation)
Another option would be to use a CSS framework with linearization support like YAML and rebuild the design. Or probably a combination of both since the image would need special care anyway.
Also keep in mind that due to the small form factor of mobile devices, large margins should be avoided.
Try giving the Paragraph {text-align: justify;} and see if it helps reduce the right spacing issue in mobile browser.