Make website responsive?- Beginner

Hi all,

I’m currently very new to the web development scene, I’ve only ever briefly touched up on it during university.

I’m currently making a portfolio for LinkedIn and would like my website to be responsive to resizing and mobile compatibility as well as other devices.

The issue that i’m having is that when I try to zoom in and out of the website it seems to be all over the place, the background would not stretch out to fill the screen and the nav bar would not resize. The text would also be a mess.

I’ve used gumby frameworks as part of the website. The webpage and CSS in question are both called Mainpage (.html and .css) which are attached.

As I said, the code might be horrific to view but I am very new to this and very keen to learn.

The pictures attached are showing the website on my laptop where the layout and formatting is all over the place, however on my computer, which it was developed on seems fine apart from when the window is resized? Picture of website with re-sizing issue

Any comments and solutions are welcome, it would be a big help.

Many Thanks

HTML

  <!doctype html>
     <html lang="en">
     <head>
        <title>Website Homepage</title>
        <meta charset="utf-8" />   
        <!-- Gumby CSS  -->
        <link rel="stylesheet" href="gumby/css/gumby.css">
        <!-- Gumby uses Moderniser JS -->      
        <script src="gumby/js/libs/modernizr-2.6.2.min.js"></script>

        <script type="text/javascript" src="https://platform.linkedin.com/badges/js/profile.js" async defer></script>

        <!-- Application custom CSS -->       
        <link rel="stylesheet" href="Mainpage.css">


    
     </head>
     <body>
        <div id="demo_navbar" class= 'fade-in-bar'>
           <div id="main_nav" class="pretty navbar row">
              <a href="#" gumby-trigger="#main_nav > ul" class="toggle">
                 <i class="icon-menu"></i></a>
                 <h3 class="four columns logo"><a href="#">Portfolio</a></h3>
                 <ul class="eight columns">
                    <li><a href="StartingXI.html">Starting XI</a>
                       <li><a href="Legends.html">Legendary Players</a>
                          <li><a href="MUFCkits.html">Manchester United Kits</a>
                             <li><a href="Alltimegoalscorers.html">Top Goalscorers Of All Time</a>     
                          </ul>

                       </div>
                    </div>



                 <h1 class= 'fade-in-name'> Manav Trivedi</h1> 

                  <p class= 'fade-in-degree'> B.Sc (Hons) Computer Forensics and Security</p>

                  <a id='linkedin' class='linkedin' href="https://www.linkedin.com/in/manav-trivedi-687569109"><img src="linkedin.jpg"/> 
                  </a>

                   <a id='twitter' class='twitter' href="https://twitter.com/ManavTrivedi"><img src="twitter.jpg"/> 
                  </a>

                   <a id='facebook' class='facebook' href="https://www.facebook.com/Manav.T"><img src="facebook.jpg"/> 
                  </a>


                <!--  <div id= "LI-profile-badge" class="LI-profile-badge"  data-version="v1" data-size="medium" data-locale="en_US" data-type="horizontal" data-theme="dark" data-vanity="manav-trivedi-687569109"><a class="LI-simple-link" href='https://uk.linkedin.com/in/manav-trivedi-687569109?trk=profile-badge'></a></div>



                                            

                                  
                          <!-- Gumby JS includes -->
                          <script src="gumby/js/libs/jquery-2.0.2.min.js"></script>
                          <script gumby-touch="gumby/js/libs" src="gumby/js/libs/gumby.min.js"></script>
                          </body>
                       </html>

CSS

body {
	text-align: center;
	height: 100%;
	width: 100%;
	background: url("background.jpg") no-repeat center center fixed;
	font-family: 'Oswald', 'sans-serif';
	color: #ffffff;
	font-size: 10em;
	max-width: 50%;
	margin: auto;
}

h1{

 height: 200px;
    width: 400px;

    position: fixed;
    top: 40%;
    left: 50%;
    margin-top: -200px;
    margin-left: -200px;
    font size: 20em;
    font-family: 'Lucida Handwriting';
    color: #ffffff;

}

img.center {
	display:block;
	
	float:right ;
}

#demo_navbar {
font-family: 'Lucida Handwriting';
position: fixed;
text-align: justify;
max-width:150%;

}

#main_nav {
	color: #ffffff;
max-width:88%;

}

h3 {
color: #fff;
    font-family: 'Lucida Handwriting';


}

p {
	height: 50px;
    width: 400px;

    position: fixed;
    top: 60%;
    left: 50%;
    margin-top: -200px;
    margin-left: -200px;
    font-size: 12.5%;
    font-family: 'Lucida Handwriting';
    color: red;

}

/*#LI-profile-badge {

	height: 300px;
    width: 400px;

    position: fixed;
    top: 70%;
    left: 53.5%;
    margin-top: -200px;
    margin-left: -200px;
    font-size: 12.5%;
    font-family: 'Lucida Handwriting';
    color: red;
    text-align: justify;

}*/

#linkedin{
height: 55px;
    width: 58px;

    position: fixed;
    top: 70%;
    left: 53.5%;
    margin-top: -200px;
    margin-left: -200px;
    font-size: 12.5%;
    font-family: 'Lucida Handwriting';
    color: red;
    text-align: justify;


}

#twitter{
height: 55px;
    width: 68px;

    position: fixed;
    top: 70%;
    left: 58.5%;
    margin-top: -200px;
    margin-left: -200px;
    font-size: 12.5%;
    font-family: 'Lucida Handwriting';
    color: red;
    text-align: justify;


}

#facebook{
height: 55px;
    width: 62px;

    position: fixed;
    top: 70%;
    left: 64%;
    margin-top: -200px;
    margin-left: -200px;
    font-size: 12.5%;
    font-family: 'Lucida Handwriting';
    color: red;
    text-align: justify;


}


.fade-in-bar {
	animation: fadeIn 1s;
}

@keyframes fadeIn {
	from {
opacity: 0;

	}
	to{
		opacity: 1;
	}
}


.fade-in-name {
	animation: fadeIn 3s;
}

@keyframes fadeIn {
	from {
opacity: 0;

	}
	to{
		opacity: 1;
	}
}

.fade-in-degree {
	animation: fadeIn 7s;
}

@keyframes fadeIn {
	from {
opacity: 0;

	}
	to{
		opacity: 1;
	}
}

.linkedin {
	animation: fadeIn 8s;
}

@keyframes fadeIn {
	from {
opacity: 0;

	}
	to{
		opacity: 1;
	}
}

.twitter {
	animation: fadeIn 8s;
}

@keyframes fadeIn {
	from {
opacity: 0;

	}
	to{
		opacity: 1;
	}
}

.facebook {
	animation: fadeIn 8s;
}

@keyframes fadeIn {
	from {
opacity: 0;

	}
	to{
		opacity: 1;
	}
}


/*.LI-profile-badge {
	animation: fadeIn 10s;
}

@keyframes fadeIn {
	from {
opacity: 0;

	}
	to{
		opacity: 1;
	}
}*/

I was not able to attach the pictures showing the problem but running the code and resizing the website should show the main problem

The very first thing that jumps out without closely studying it is the absence of the viewport meta tag:-

<meta name=viewport content="width=device-width, initial-scale=1">

A must in a responsive page.

Thank you for the swift reply, as I said i’m very new to this, I’ve put the metatag in and I didn’t notice any difference, I did some reading and the tag is supposed to gatherer information about the device and resizing of the page to tailor the device of which it’s displayed on. I’ve included the code with the meta tag:


<!doctype html>
<html lang="en">
<head>
<title>Website Homepage</title>
<meta charset="utf-8" />
<!-- Gumby CSS  -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="gumby/css/gumby.css">
<!-- Gumby uses Moderniser JS -->
<script src="gumby/js/libs/modernizr-2.6.2.min.js"></script>
<script type="text/javascript" src="https://platform.linkedin.com/badges/js/profile.js" async defer></script>

<!-- Application custom CSS -->
<link rel="stylesheet" href="test.css">
</head>
<body>
<div id="demo_navbar" class= 'fade-in-bar'>
  <div id="main_nav" class="pretty navbar row"> <a href="#" gumby-trigger="#main_nav > ul" class="toggle"> <i class="icon-menu"></i></a>
    <h3 class="four columns logo"><a href="#">Portfolio</a></h3>
    <ul class="eight columns">
      <li><a href="StartingXI.html">Starting XI</a>
      <li><a href="Legends.html">Legendary Players</a>
      <li><a href="MUFCkits.html">Manchester United Kits</a>
      <li><a href="Alltimegoalscorers.html">Top Goalscorers Of All Time</a>
    </ul>
  </div>
</div>
<h1 class= 'fade-in-name'> Manav Trivedi</h1>
<p class= 'fade-in-degree'> B.Sc (Hons) Computer Forensics and Security</p>
<a id='linkedin' class='linkedin' href="https://www.linkedin.com/in/manav-trivedi-687569109"><img src="linkedin.jpg"/> </a> <a id='twitter' class='twitter' href="https://twitter.com/ManavTrivedi"><img src="twitter.jpg"/> </a> <a id='facebook' class='facebook' href="https://www.facebook.com/Manav.T"><img src="facebook.jpg"/> </a> 

<!--  <div id= "LI-profile-badge" class="LI-profile-badge"  data-version="v1" data-size="medium" data-locale="en_US" data-type="horizontal" data-theme="dark" data-vanity="manav-trivedi-687569109"><a class="LI-simple-link" href='https://uk.linkedin.com/in/manav-trivedi-687569109?trk=profile-badge'></a></div>
                                                                         
                           <!-- Gumby JS includes --> 
<script src="gumby/js/libs/jquery-2.0.2.min.js"></script> 
<script gumby-touch="gumby/js/libs" src="gumby/js/libs/gumby.min.js"></script>
</body>
</html>

Apologies for the reply code it hasn’t formatted correctly, i Have basically just put the meta tag in the header below the “meta charset=utf8” in the head of the html code.

I formatted it for you (I think) :slight_smile:

1 Like

Thank you very much, hopefully get the issue resolved soon :slight_smile:

I think we may need to start from scratch as the code you are using is unmanageable and won’t do what’s required of it. :frowning:

Fixed positioning should only be used in small doses and generally for things like small headers or footers or a fixed sidebar. A fixed element does not scroll with the viewport which means that on any screen that isn’t the exact same size that you designed it at the content will be unreachable.

You are also placing the elements directly into place using co-ordinates which makes them immovable and unable to react to screen size had you built them with some scalability in mind.

99% of the time you will not use absolute or fixed positioning to place items on the web page. You need to create elements that flow logically from one to the next and then using media queries you can set revise elements where required so that they can fit a larger.smaller display according to the logistics of the layout.

Don’t worry though the mistakes you have made are the mistakes that every beginner makes and are just the beginning of a long journey :slight_smile:

What we probably need to start with is a drawing of the type of page you want to achieve and then we can discuss how you would lay it out.

2 Likes

Many thanks for the reply,

I had a feeling it may have needed to be done again because as you said the code is unmanageable.

I would love the web page to look like this with the nav bar (having different names) redirecting the page to go further down the main page (displayed on the picture) rather than redirecting to an entire different page. I believe some form of transition would be good to implement to go down from the main page to the content selected from the nav bar.

I can imagine the pain you had to go through to read my code but at this stage I would love the website to have some form of correctly implemented functuionality to be viewed and responsive on multiple devices.

Thank you for your help.

Hi,

That sort of setup is very similar to an old template of mine so you may want to spend some time studying this page and trying to work out how it works. If you view source in chrome you can get the html and then click on the css file to see the whole css.

Note for scrolling animation or scrolling to links you will need to use JS (I’ve used jquery because my skills in JS are limited).

You should be able to copy my page and then substitute your own image and then it will be a matter of moving your extra elements into place.

This codepen also shows how to have an initial 100% image with content underneath and is a very basic example. There are other modern ways to do this using flexbox and vh units but the old way still works.

You may just want to fork the codepen and then practice for a while. Set up a codepen account and then you can share the code with us more easily and allow for quicker responses etc.

Remember that if you have a fixed header then you need it preferably as small as possible with content that will not wrap when screen size gets smaller or turns into a hamburger menu when space is limited.

There’s a lot to take in so take your time :slight_smile:

1 Like

That website template provided is a fantastic representation of what I want to achieve.

I’m a bit unsure what the codepen suggested page was for, i’m guessing that’s just to practice

Should I get stuck I will contact you once again, thank you for providing the details on how to achieve a scroll animation and a template to achieve my website design.

Many Thanks for everything

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