Responsive websites won't function properly

Hello all, I am currently working on centering my Navigation at screen sizes of 320 pixels or less. My goal is to have the logo centered at the top, followed by a centered navigation below, and then everything else aligned accordingly. However, I seem to be facing some difficulty in achieving this. Below is my HTML code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   <!-- <!DOCTYPE html> -->
   <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
    <title>Jake Jones New Media Design</title>

      <meta charset="utf-8">

  <link rel="stylesheet" type="text/css" href="style.css"/>

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

</head>
<body>

<div class="wrapper">

    <div id="logo"><a href="index.html"><img src="logo.jpg" alt="logo"/></a></div>

<ul id="Menu">  
    <li>
    <a href="index.html">Portfolio</a>
    <ul>
        <li><a href="index.html#web">Web</a></li>
        <li><a href="index.html#campaign">Campaign</a></li>
        <li><a href="index.html#print">Print</a></li>
        <li><a href="index.html#motion">Motion</a></li>
        <li><a href="index.html#photography">Photography</a></li>
        <li><a href="index.html#vector">Vector</a></li>
    </ul>
   </li>
  <li><a href="about.html">About</a></li>
</ul>
    <div class="text">

        <div class="imgContainer">
        <img src="img/me.jpg" style="width: 100%"/>
    </div>

        <p>
Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend        tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,  </p>

<div class="pdf">
<a href="resume.pdf">Resume</a>   |   
<a href="portfolio.pdf">Portfolio PDF</a> 
</div>

<div class="contact">
(330)285-3158 <br/>
<a href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6e1a060b0401000b1d0d1c0b0f1a07180b2e09030f0702400d0103">[email protected]</a>"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86f2eee3ece9e8e3f5e5f4e3e7f2eff0e3c6e1ebe7efeaa8e5e9eb">[email protected]</a></a>
</div> 

    </div>


</div>
</body>
</html>

Below you can find my CSS code as well:

@charset "UTF-8";

body {
font-family: helvetica; 
font-size:12px; 
}

.wrapper {
margin: 0 auto;
max-width: 980px;
width: auto;        
}

#logo {
float: left;
}

#Menu,
#Menu ul {
list-style: none;
}

#Menu {
float: right;
margin-top: 85px;
}

#Menu > li {
float: left;
}
#Menu li a {
display: block;
height: 2em;
line-height: 2em;
padding: 0 1.5em;
text-decoration: none;
}

#Menu ul {
position: absolute;
display: none;
z-index: 999;
}

#Menu ul li a {
width: 50px;
}

#Menu li:hover ul {
display: block;
}

/* Main menu
------------------------------------------*/
#Menu {
font-family: Arial;
font-size: 12px;
background: #ffffff;
}

#Menu > li > a {
color: #000000;
font-weight: bold;
font-size: 15px;
}

#Menu > li:hover > a {
background: #ffffff;
color: #7a0808;
}

/* Submenu
------------------------------------------*/
#Menu ul {
background: #ffffff;
padding: 0;
list-style-type: none;
width: 100px;
}

#Menu ul li a {
color: #000000;
font-size: 13px;

}

#Menu ul li:hover a {
color: #7a0808;
}

/* Content
------------------------------------------*/
.text {
clear: both;

}

p {
padding-top: 70px;
padding-left: 40px;
width: 275px;
}


.imgContainer {
margin-top: 70px;
float:right;
clear: both;
padding-right: 15px;
}

.pdf {
padding-left: 40px;
}

.pdf a:link {
color: black;

}

.pdf a:hover {
color: #7a0808;
}

.pdf a:visited {
color: #838383;
}

.contact {
line-height: 17px;
padding-top: 20px;
padding-left: 40px;
}

.contact a:link {
text-decoration: none;
color: black;
}

img {
max-width:100%
}

}


/* Responsive Styles */

@media screen and (max-width : 300px){
#logo {
width: 50%
}

#Menu a:link {
padding: 0px; 
text-align: center;
float: left;
width: 100%;
}
 }

Answer №1

Ensure that your image tag in the style has only one closing bracket - remove the extra one so it appears like this:

img {
    max-width:100%;
}

To make it responsive, include the following code:

@media screen and (max-width: 360px) {
#logo {
    text-align:center;
    float:none;
    }
#Menu{
    float:none;
}
#Menu > li {
margin-right: 15px;
}
   #Menu a:link {
    padding: 0px; 
    text-align: center;
    float: left;
    width: 100%;
   }
 }

View the demonstration on http://jsfiddle.net/nikkirs/vmcrtej3/

Answer №2

Creating CSS rules for the class wrapper and id logo specifically targeting screens with a width of 300px can help improve responsiveness. Give it a try and see how it enhances the overall layout.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Switch between classes using jQuery

Hello there, I have a code snippet that I need help with: <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> $(document).ready(function() { $("b"). ...

adjust the webpage to be optimized for the size of the screen

Looking to adjust the webpage layout so that it fits perfectly on the screen without the need for vertical or horizontal scrolling. Additionally, we want the image to be centered. See below for the current code snippet: #copyright { top: 0px; right: ...

Trouble with the drop-down menu displaying "string:2" in an AngularJS application

Currently, I am utilizing AngularJS ng-model to choose the value from a drop-down menu. Additionally, I am implementing datatable for organizing the columns. <select id="{{user.id}}" ng-model="user.commit" name="options" ng-change="update_commit_level ...

Style line breaks using CSS

Can CSS(3) be used to visually or textually emphasize line breaks that were automatically added by browsers? For example, displaying a symbol like ↻ at the end of each wrapped line. It is crucial to identify where lines were wrapped in source code, as n ...

What could be causing my JSON product list to not load properly?

My list is not loading and I can't figure out why. I've included my json, jquery, and HTML below. The console isn't showing any errors, but the list is still blank. Any help would be greatly appreciated as I am new to working with json. Than ...

What is the best way to implement a scrolling effect for a specific div tag using CSS?

I am facing an issue with scrolling a specific div tag, it seems to not be working as expected. <body style="margin:0; padding:0;"> <div id="head" style="width:100%; height:18%; background:#2a2a2a; position:fixed; overflow-y:hidden; "> <div ...

What is the best way to customize the styles of an autofilled input in Chakra UI?

Currently, I am customizing the styling of my input fields using Chakra UI's extendTheme function. However, I have encountered a challenge with styling inputs that have been auto-filled. The :autofill pseudo selector does not seem to work as expected ...

I am interested in setting up a flickr gallery where clicking on an image will display a pop-up showing the image along with its relevant tags, title, and photo ID

Page´s photo Hello there, I am currently working on creating a Flickr API using JavaScript and HTML. My goal is to search for photos and display them in an HTML page, but I'm struggling with implementing a pop-up feature that includes the photo' ...

The automated Login Pop Up button appears on its own and does not immediately redirect to the login form

Hey guys, I'm struggling with modifying the jquery and html to ensure that when the login button is clicked, the login form pops up instead of displaying another login button. Another issue I am facing is that the login button seems to pop up automati ...

Implement a customized toString method for components in ReactJS

Looking to modify the toString method of a class component in reactjs? Check out the code snippet below class C1 extends React.Component{ render(){ return ( <div> {C2.toString()} </div> ) } } class C2 extend ...

I'm currently in the process of incorporating horizontal scrolling into various sections of an image gallery. The images will stack vertically only when the window width

I am currently developing an image gallery with multiple sections that contain various images. My goal is to arrange each section of images in a single row, allowing horizontal scrolling similar to Netflix's layout. However, I'm facing challenges ...

What is the reason for having two scroll bars and how can I eliminate one of them?

Is there a way to remove one of the two vertical scrollbars on my webpage? Lorem ipsum is included for testing purposes. Apologies for the content being in another language. * { margin: 0; padding: 0; box-sizing: border-box; } html { overflow-x ...

Issue: Map container not located when implementing a leaflet map with Angular

Here is the complete error message: core.js:6479 ERROR Error: Map container not found. at NewClass._initContainer (leaflet-src.js:4066) at NewClass.initialize (leaflet-src.js:3099) at new NewClass (leaflet-src.js:296) at Object.createMap [a ...

Tips for showing both label and value on a pie slice in Apex charts

I am currently utilizing apex chart within an angular application to showcase charts. I am specifically focusing on a pie chart and aiming to customize it by displaying labels on the values within each slice of the pie, similar to what is shown in the atta ...

What is the best way to combine flex-direction and flex-wrap in one row?

I'm working with a React component that looks like this: <Card className='form-margin width card' zDepth='3'> <CardText> <strong>Test</strong><br /> This is some text </Card ...

The concept of setting a value is not defined in JavaScript when compared to

Within my primary python script, the following code snippet is present. @app.route('/accounts/test/learn/medium') def medium(): word = random.choice(os.listdir("characters/")) return render_template('accounts/test/medium.html', word=w ...

send a json response from my webpage

I have recently developed an HTML code to construct a user form where individuals can input information into various text fields. Additionally, I have included a button on the page that is meant to gather all the entered data and transform it into a json f ...

Experiencing issues where an undefined value is being returned while attempting to pass a selected value

I'm facing a minor issue with my JavaScript code. Below is the form structure I am working with: <form method="get" name="basic" id="basicId" action="/page2"> <select id="activity" name="activity" class="form-control inputbox"> ...

What is the most effective method for populating an array with all images from a particular directory?

I recently installed a pdf viewer plugin on my website (check it out here: ), and I have a question regarding its functionality. I am looking to include approximately 60 - 70 pages in this flip book, but I am unsure of how to proceed. I have attempted var ...

Stacking images with CSS styling

I'm currently working on creating a CSS design template. Within this project, I have two images named imageOne and imageTwo. Both images are styled with position: relative, as setting one to position: absolute would compromise the responsiveness of ...