0

I have a single paged scrolling website. the problem is that when I check the website on larger or smaller screens the text alignment and on 15 Inch screen its perfect. You can see the preview at (link removed)

Try changing the screen sizes and check the text alignment. I want the text to change its place according to the screen resolution.

The CSS is

html {
height: 100%;
}
body
{
margin:0;
padding:0;  
background-image:url('../images/bgs/bg.jpg');
background-repeat:no-repeat;
background-attachment:fixed;
margin: 0;
background-size:contain;
padding: 0;
height: 100%;
width: 100%;
position:relative;
bottom:0px;
top:0px;
margin-top:0px;
margin-bottom:0px; 
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover; 
max-height:100%;
max-width:100%;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/bgs/bg.jpg', sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/bgs/bg.jpg', sizingMethod='scale')";
font-family:Trebuchet MS, Arial, 'Helvetica', sans-serif;
font-size:1em;
}

.logo
{
background-image:url('../images/logo.png');
background-repeat:no-repeat;
max-height:auto;
max-width:100% !important;
margin-left: auto;
margin-right: auto;
}

.taste
{
background-image:url('../images/bgs/bg2.jpg');
background-repeat:no-repeat;
background-attachment:fixed;
margin: 0;
background-size:contain;
padding: 0;
height: 100%;
width: 100%;
position:relative;
bottom:0px;
top:0px;
margin-top:0px;
margin-bottom:0px;
-webkit-background-size: contain;
-moz-background-size: contain;
-o-background-size: contain;
max-height:100%;
max-width:100%;
background-position:center;
min-height:100%;
min-width:100%;
}

.taste-div
{
padding-left:33%; 
width:23%;
text-align:justify;
padding-top:3%;
padding-bottom:8%;
display:block;  
color:#000;
font-family: Arial, 'Helvetica', sans-serif;
position: relative;
}

and the relevant HTML is

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"> 
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="HandheldFriendly" content="true">
<meta name="keywords" content="" />
<meta name="author" content="Aamir Ali Bangash | ATOM Digital" />
<meta name="description" content="" />
<title>Sweet!</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/mobile.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery-scrolltofixed.js" type="text/javascript"></script>
<script src="js/smooth-scroll.js"></script>
<script>
    $(document).ready(function() {

        // Dock the header to the top of the window when scrolled past the banner.
        // This is the default behavior.

        $('.header').scrollToFixed();



    });

    $(function() {
  $('a[href*=#]:not([href=#])').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
      if (target.length) {
        $('html,body').animate({
          scrollTop: target.offset().top
        }, 1000);
        return false;
      }
    }
  });
});
</script>
</head>
    <body>
    <div class="banner">
    <div class="main" align="center"><a href="main.html"><img src="images/logo1.png" style="display:block;" border="0"></a></div>
    </div>
    <div class="header">
    <div class="main"><span class="title">
    <ul class="nav">
    <li><a href="main.html" class="scroll" data-speed="2000" data-easing="easeInOutCubic">THE SWEET! TASTE</a></li>
    <li> | </li>
    <li><a href="#shaka" class="scroll" data-speed="2000" data-easing="easeInOutCubic">THE SWEET! SHAKA</a></li>
    <li> | </li>
    <li><a href="#match" class="scroll" data-speed="2000" data-easing="easeInOutCubic">THE SWEET! MATCH</a></li>
    <li> | </li>
    <li><a href="#hub" class="scroll" data-speed="2000" data-easing="easeInOutCubic">THE SWEET! HUB</a></li>
    </ul>
    </span></div>
    </div>
<!-- taset page -->
    <div class="taste" id="taste">
    <div class="taste-div">
    Everyone is loving the sweet taste, easy drinking wines packed with flavour, fruitiness and fun.</td>
    <p><h3>sweet! White 75cl</h3>
    <strong>Description!</strong> Sweet peach and apricot fruit flavours with a hint of lychee and tangy citrus. Ripe, fruity and very refreshing. <br />
    <strong>Origin!</strong> Western Cape, South Africa<br />
    <strong>Grape variety!</strong> Blend of Chenin Blanc, Semillon and Muscat d’Alexandrie<br />
    <strong>Alcohol!</strong> 12% by volume</p>
    <p>
    <h3>sweet! Red 75cl</h3>
    <strong>Description!</strong> Sweet red and black berry flavours with a hint of tropical fruit and mocha spice. Smooth, easy-drinking and moreish. 
Origin! Western Cape, South Africa<br />
    <strong>Grape variety!</strong> Blend of Merlot, Pinotage and Muscat d’Alexandrie<br />
    <strong>Alcohol!</strong> 13.5% by volume</p>
    </div>
    <div style="text-align:center;padding-bottom:10px;"><a href="#shaka"><img src="images/lb/bottom.png" border="0" /></a></div>
    </div>
    </div>
Bangash
  • 87
  • 1
  • 2
  • 13
  • So, What do you mean by `want the text to change its place according to the screen resolution`? As i can see the width of text is too small, Do you want to increase the width in small screens? – Surjith S M Jan 02 '14 at 06:21
  • yes Surjeet I want the text to be responsive on all screens and not to change its padding from top, bottom and left. – Bangash Jan 02 '14 at 06:24

2 Answers2

0

what you want to achieve according to screen size for fonts will be slightly difficult.

I suggest you use media-queries combined with font size units rem and em

for eg:

@media only screen and (max-width: 1024px) {

   body { font-size: 3rem; }

}

Alternatively, you can use view ports for your comfort too, using unit vw or vh for the fonts

for e.g

body {
    font-size: 12px;
    font-size: 2.5vw; 
}

Note : you will have to set <meta name="viewport" content="width=device-width" /> in your header when using such view-port based typography...

1vw = 1% of viewport width
1vh = 1% of viewport height

EDIT

In the link your provided, the only solution i can see to it is to use media queries to align the text properly!!

  • The issue is not the font soze bro. The problem is the static position of the text. I want it move according to the screen size. – Bangash Jan 02 '14 at 06:15
  • I have added Head html as well for your reference. kindly check that – Bangash Jan 02 '14 at 06:19
  • @Bangash : use media queries mate....that is the only solution, check the link in my edit part to see the standard break-point –  Jan 02 '14 at 06:19
  • @NoobEditor The media queries are already there when I inspect on smaller screen size. – Surjith S M Jan 02 '14 at 06:22
0

Try increasing width in the following media query

@media (max-width: 700px) {
.taste-div { 
 width: 65%;
}
}

So the width will increase on small devices.

Update

The only thing you can do is create another media with the size of 19inch monitor, like

@media (min-width:1440px) {
.taste-div { 
 width: 30%; /*or what ever*/
}

Then you can adjust the width for 19inch monitor. This won't affect other sizes.

Surjith S M
  • 6,642
  • 2
  • 31
  • 50
  • Thanks Surjeet but the text is still static its not aligning according to the screen resolution. – Bangash Jan 02 '14 at 06:35
  • What do you mean by `aligning according to the screen resolution`? Do you want full width on all resolutins? – Surjith S M Jan 02 '14 at 06:36
  • When you change the resolution of the screen I want the text to align properly just like on 15 inch screen. neither more nor less. – Bangash Jan 02 '14 at 06:38
  • Now it seems same as you expected. Can you explain with two screenshots? That would be better to understand. – Surjith S M Jan 02 '14 at 06:43
  • Here are the links to the screenshots on 15inch screen it looks like http://i39.tinypic.com/20uopw5.jpg and on 19inch screen it looks like http://i40.tinypic.com/2d1n3gm.jpg Check the alignment of both images. – Bangash Jan 02 '14 at 06:48
  • Thanks Surjeet but that didnt helped. This mean I will have to add separate media query for all sizes – Bangash Jan 02 '14 at 07:18