user3236977
user3236977

Reputation: 15

My website is not fitting to each screen resolution of pc

Hello i have created a website in 3 months using HTML, CSS, Jquery and PHP.

for design and layout i have used CSS, after building this website i have noticed that

Whenever i m opening my website in small screens so there is need of width scroll to see

whole page especially the language dropdown selection in right corner of page.

in my CSS i have used PX for divs such as wrapper, header and etc

Someone told me to use Percentage instead of PX, but i have reached to end.

First guys what i should do to solve this problem?

Second is there any way to convert from PX to Percentage.

.wrapper
{

  width:1320px;
  height:760px;
  border:solid 1px #000;
  margin:0 auto;
  background:url(images/Background_Image.jpg) no-repeat;    
}
.wrapper .logo
{
    background:url(images/logo.png) no-repeat bottom;
    width:360px;
    height:180px;
    margin-left:345px;
    margin-top:10px;
    float:left;
}
.wrapper .language
{
    float:right;
    background-color:#006;
    padding:5px 10px;
    border-radius:4px;
    -webkit-border-radius:4px;
    -moz-border-radius:4px;
    -ms-border-radius:4px;
    -o-border-radius:4px;
    border:#00AEEF;
    color: #FFFFFF;
    font:bold 1.2em "Calibri";
    margin:0px 0px 0px 0px;
    cursor:pointer;
    text-align:center;
}
.wrapper .language a
{
    color:#FFF;
    text-decoration:none;
    font:"calibiri";
}

.wrapper .search_property
{
    width:300px;
    height:500px;
    margin-right:58px;
    margin-top:80px;
    float:right;
}
.wrapper .search_property .title
{
    background:url(images/protitle.fw.png) no-repeat;
    width:295px;
    height:80px;
    margin-bottom:10px;
    float:left;
    text-align:center;
    color:#FFF;
    font: bold 1.7em "Calibri";
}
.wrapper .search_property .province
{
    background:url(images/proprovince.fw.png) no-repeat;
    width:295px;
    height:70px;
    float:left;
    margin-bottom:10px;
    text-align:center;
}

/* start design for the province */
select 
{
    width:195px;
    margin-top:23px;
    padding:3px 3px 3px 46px;
    font: bold 1em "Calibri";
    -webkit-border-radius:1px;
    -moz-border-radius:1px;
    border-radius:1.3px;
    -webkit-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
    -moz-box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
    box-shadow: 0 3px 0 #ccc, 0 -1px #fff inset;
    background: #f6f6f8;
    color:#000;
    border:none;
    outline:none;
    display: inline-block;
    -webkit-appearance:none;
    -moz-appearance:none;
    appearance:none;
    cursor:pointer;
}
option
{
    text-align:center;
}
/* Targetting Webkit browsers only. FF will show the dropdown arrow with so much padding. */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    select {padding-right:18px}
}

.la 
{
    position:relative;
}
.la:after {
    content:'<>';
    font:11px "Consolas", monospace;
    color:#000;
    -webkit-transform:rotate(90deg);
    -moz-transform:rotate(90deg);
    -ms-transform:rotate(90deg);
    transform:rotate(90deg);
    right:8px; top:2px;
    padding:0 0 2px;
    border-bottom:1px solid #ddd;
    position:absolute;
    pointer-events:none;
}
.la:before {
    content:'';
    right:3.5px; 
    top:-1px;
    width:25px; height:22px;
    background:#ccc;
    position:absolute;
    pointer-events:none;
    display:block;
}
/* end   design for the province */

.wrapper .search_property .district
{
    background:url(images/prodistrict.fw.png) no-repeat;
    width:295px;
    height:70px;
    float:left;
    margin-bottom:10px;
    text-align:center;

}
.wrapper .search_property .propertystatus
{
    background:url(images/prostatus.fw.png) no-repeat;
    width:295px;
    height:90px;
    float:left;
    margin-bottom:10px;
    color:#FFF;
    padding:20px 0 0 0;
}
radio
{
    cursor:pointer;
}
.wrapper .search_property .probutton
{
    width:270px;
    height:50px;
    float:left;
    margin-bottom:3px;
    padding:0 0 0 25px;
}

.wrapper .search_property .postprobutton
{
    width:285px;
    height:40px;
    float:left;
    margin-top:5px;
    padding:0 0 0 10px;
}

#Submitbutton
{
    background: #006 url(images/a.fw.png) no-repeat right;
    padding:5px 15px;
    border-radius:4px;
    width:233px;
    -webkit-border-radius:4px;
    -moz-border-radius:4px;
    -ms-border-radius:4px;
    -o-border-radius:4px;
    border:#00AEEF;
    color: #FFFFFF;
    font:bold 1.5em "Calibri";
    margin:0px 0px 0px 0px;
    cursor:pointer;
    text-align:left;
}
#pypbutton
{
    background: #006 url(images/Property%20List.png) no-repeat right;
    padding:5px 15px;
    border-radius:4px;
    -webkit-border-radius:4px;
    -moz-border-radius:4px;
    -ms-border-radius:4px;
    -o-border-radius:4px;
    border:#00AEEF;
    color: #FFFFFF;
    font:bold 1.4em "Calibri";
    margin:0px 0px 0px 0px;
    cursor:pointer;
    text-decoration:none;
}
.wrapper .slideshow
{
    width:395px;
    height:264px;
    margin-left:325px;
    margin-top:24px;
    float:left;
}
.wrapper .menu
{
    width:412px;
    height:20px;
    margin-left:327px;
    margin-top:40px;
    float:left;
}
.wrapper .menu .aboutus
{
    width:68px;
    height:18px;
    color:#fff;
    font: 1em Arial, Helvetica, sans-serif;
    margin:0px 5px 0px 0px;
    cursor:pointer;
    float:left;
    border-right:#039 solid 3px;
}
.wrapper .menu .myaccount
{
    width:85px;
    height:18px;
    color:#fff;
    margin:0px 5px 0px 0px;
    font: 1em Arial, Helvetica, sans-serif;
    cursor:pointer;
    float:left;
    border-right:#039 solid 3px;
}
.wrapper .menu .services
{
    width:65px;
    height:18px;
    color:#fff;
    font: 1em Arial, Helvetica, sans-serif;
    margin:0px 5px 0px 0px;
    cursor:pointer;
    float:left;
    border-right:#039 solid 3px;
}
.wrapper .menu .career
{
    width:54px;
    height:18px;
    color:#fff;
    font: 1em Arial, Helvetica, sans-serif;
    margin:0px 5px 0px 0px;
    cursor:pointer;
    float:left;
    border-right:#039 solid 3px;
}
.wrapper .menu .contactus
{
    width:87px;
    height:18px;
    color:#fff;
    font: 1em Arial, Helvetica, sans-serif;
    margin:0px 5px 0px 0px;
    cursor:pointer;
    float:left;
}
.wrapper .footer
{
    background:url(images/footerbg.jpg) bottom;
    width:1120px;
    height:155px;
    margin-top:15px;
    float:left;
    margin-left:100px;
}
.wrapper .footer .footer_in 
{
    width: 900px;
    height: auto;
    margin: auto;
    padding: 14px 0px 0px 0px;
}
.wrapper .footer .footer_in .footer_navigation 
{
    /*width:412px;*/
    height:128px;
    float:left;
    font-size:11px;
    background:url(images/border.jpg) right no-repeat;
    font: 1em "Calibri";
    width:350px;
}
.wrapper .footer .footer_in .footer_navigation .fn_heading 
{
    width:310px;
    font: 1em "Calibri";
    color:#fff;
    height:37px;
    font-size:12px;
    background:url(images/footerimg.png) no-repeat;
    padding-left:10px;
    line-height:24px;
}
.wrapper .footer ..footer_in .footer_navigation ul {
    float:left;
    width:320px;
    padding-left:9px;
}
.wrapper .footer .footer_in .footer_navigation li {
    float:left;
    width:127px;
    background:url(images/listimg.gif) no-repeat left;
    padding-left:12px;
    display:block;
    padding-bottom:4px;
}
.wrapper .footer .footer_in .footer_navigation li a
{
    color:#fff;
    text-decoration:none;
}
.wrapper .footer .footer_in .footer_navigation li a:hover {
    text-decoration:underline;
}
.wrapper .footer .footer_in .copyright 
{
    background: url(images/border.gif) no-repeat scroll right center transparent;
    color: #FFFFFF;
    float: left;
    font: 1em "Calibri";
    min-height: 94px;
    padding-left: 14px;
    padding-right: 30px;
    padding-top: 35px;
}
.wrapper .footer .footer_in .copyright a 
{
    padding-bottom:5px;
    color:#fff;
    text-decoration:none;
}
.wrapper .footer .footer_in .copyright a:hover
{
    text-decoration:underline;
}
.wrapper .footer .footer_in .footer-add
{ 
text-align:center;
 width:220px;
 float:right;
 margin-left:10px;
  font: 1em "Calibri";
}
.wrapper .footer .footer_in .footer-add a
{ 
color:#fff; 
background:url(images/link_for_scale-new_03.png) no-repeat bottom;
height:122px;
display:block; 
}

Upvotes: 0

Views: 74

Answers (1)

hawaii
hawaii

Reputation: 358

Check your monitor resolution (By the CSS, my guess is that it is 1440x768).

Now do this math with every pixel value: ("Pixel Width Value"/1440)*100 and ("Pixel Height Value"/768)*100.

That is your value in %!

Some elements might not work properly, but it's a good way to start.

There are also other units that can work depending on the screen size check one of them here.

However I think % might be the best for you to start out.

Upvotes: 1

Related Questions