As I adjust the size of my browser, all the elements shift around

When I resize my browser, all elements change their position. Can anyone help me with this issue? The logo and navigation elements are not affected when I resize the browser. I have tried setting the position to fixed, absolute, or static but it doesn't resolve the problem.

<head>
<title>www.adamkides.com/main</title>
<link rel="icon" href="logo.jpg" type="image/x-icon">
<link href='http://fonts.googleapis.com/css?family=Archivo+Narrow:700italic,700,400' rel='stylesheet' type='text/css'>
<style type="text/css">
a{color:black;}
body {
font-family: 'Lucida Grande', helvetica, arial, sans-serif;
font-size: 12px;
background: white;
background-size:101%;
height:100%;

background-image: url('dr5.jpg'); 

background-repeat:no-repeat;
margin:-70 0 0 0;
}
 #face:hover {
background: #333;

border-left: 5px solid #000;
}
#face{    MARGIN-LEFT: -850PX;
MARGIN-TOP: 1PX;}
#container
{            
margin: 0 auto;
width: 100%;
background: #fff;
 }
#header
{
background-image: url(hand.jpg);
background-size: 310px;
background-repeat: no-repeat;
    padding: 20px;
    background-color:white;
width: 320px;
height: 100px;
float:right;
margin: 70px 500px -11px 0%;
 }

 #header h1 { margin: 0; }
.navigation {
margin: 5px 20px 30px 20%;
background: #fff;
overflow: hidden;
width: 760px;
float: left;
padding-left: 100px;
box-shadow: 0 2px 10px 2px rgba(0, 0, 0, 0.2);
 }

.navigation li {
width: 120px; border-left: 5px solid #666;
float: left;
cursor: pointer;
list-style-type: none;
padding: 10px 50px 10px 15px;
-webkit-transition: all 0.3s ease-in;
-moz-transition: all 0.3s ease-in;
-o-transition: all 0.3s ease-in;
 }

.navigation li h2 {
font-family: georgia;
font-weight: bold;
font-style:arial;
font-size: 20px;
margin-bottom: 5px;
line-height: 16px;
   }

.navigation li p{
font-size: 11px;
color: #999;

-webkit-transition: all 0.1s ease-in;
-moz-transition: all 0.1s ease-in;
-o-transition: all 0.1s ease-in;
   }

.navigation li:hover {
background: greenyellow;
border-left: 5px solid #000;
 }

.navigation li:hover h2 {
font-weight: bold;
color: yellow;
 }

.navigation li:hover p {
color: orange;
padding-left: 5px;
 }
 #content-container
 {           float: left;
 width: 55%;
    margin-top: -25px;

margin-left: 320px;
height: 60%;
background: #FFF url(layout-two-liquid-background.gif) repeat-y 68% 0;
 }
.ti{
   border-color: greenyellow;
border-style: dotted;
margin-top: -70px;
border-width: thin;
width: 235px;
height: 250px;
margin-left: 295px;
font-size: 24px;
color: orange;
font-weight: 700;}
#content {
  clear: right;
float: left;
width: 60%;
padding: 5px 0;
margin: -14px -41px -294px 7%;
display: inline;
 }

#content h2 { margin: 0; }

#aside
{
float: right;
width: 26%;
padding: 20px 0;
margin: 15 320 0 0;
display: inline;
}

 #aside h3 { margin: 0; }

 #footer{margin: 30px 20px -2px 0px;
overflow: hidden;

 border-color: greenyellow;
border-style: dotted;
border-width: thin;
width: 760px;
height:100px;
background-color:white;
float: left;
padding-left: 100px;
box-shadow: 0 2px 10px 2px rgba(0, 0, 0, 0.2);}
</style>
</head>
<body>
<div id="container">
<img src="logo1.jpg" width="50px" height="50px" style="margin-top: 75px;margin-left: 522px;/* border:solid; *//* border-color:#ef5d9b; */height: 100px;float: left;width: 100px;">      <div id="header" style="background-image: url(hand.jpg);">
</div>
<ul class="navigation">
<a href="mainpage.html"><li>
    <h2>الصفحة الرئسية</h2>
    <p>main page</p>
</li></a>
<a href="f.html"><li>
    <h2>فلسفتنا</h2>
    <p>our</p>
</li></a>
<a href="how.html"><li>
    <h2>من نحن</h2>
    <p>Who we are</p>
</li></a>
<a href="gallary.html"><li>
    <h2>الاستديو</h2>
    <p>gallary</p>
</li></a>
    <a href="https://www.facebook.com/ADAM.KIDS.JORDAN/?fref=ts"><image id="face" src="face.jpg" width="80px" height="80px"/></a>

</ul>
<div id="content-container">
    <div id="content">
        <h2 style="float:right;font-size:50px;color:green;"><img src="well.jpg" width="70px" height="70px"style="margin-top:10px;">     كلمة ترحيبية    </h2>
        <p align="right"style="float:right;font-size:25px ;margin-left:-10px;color:black;">
        مرحباً بكم في صفحتنا التي عملنا بجهد متواضع لنجعل منها موقعاً متميزاً يخدم الجميع ، ليس فقط أهالي أطفال الروضة بل و أيضاً الزبائن الكرام ، و نتمنى أن تكون مرجعاً مفيداً لكم، و أن تكون حلقة وصل بيننا و بينكم ، . . . فلا تترددوا بتزويدنا بكل مقترحاتكم و آرائكم التي تساعدنا على التطور نحو الأفضل واعلموا ...

Answer №1

To ensure your website's layout adjusts smoothly across different screen sizes, it's essential to create responsive CSS. This means that the design elements should adapt seamlessly to varying browser widths and heights.

If you're new to responsive design, a helpful starting point is checking out this resource:

http://www.w3schools.com/css/css_responsive_intro.asp

Additionally, exploring CSS frameworks like Bootstrap or Foundation can provide valuable tools for building responsive layouts:

http://getbootstrap.com/

Both of these frameworks offer extensive tutorials to help you master responsive design. The provided w3schools link offers a basic introduction to using Bootstrap as well.

Answer №2

Your layout issues may be due to the combination of fixed and relative units in your CSS.

Fixed units, such as pixels, maintain their designated sizes regardless of browser changes, while relative units like percentages adjust with resizing.

Keep in mind that using fixed units could lead to horizontal scrolling on certain devices, whereas relative units will help your page adapt for a more visually appealing and responsive design.

Answer №3

Exploring the browser's development tool can reveal valuable insights into element properties and shed light on why they behave as they do. Consider, for instance, how a ul with the 'navigation' class may shift position due to its margin-left being set to 20% - a factor influenced by changes in the page's total width.

I echo the sentiments of others urging you to deepen your understanding of this topic by delving into more resources. This will help you grasp the intricacies of the samples you're currently working on.

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

It appears that Vue.js's this.$nextTick() function does not properly wait for the DOM to finish rendering

Having trouble with nextTick() in Vue. Here's the template code: In the template: <template> <div> <div v-if="editing"> <span ref="theInput" contenteditable="true">{{ someValue }}</span> < ...

What is the best way to prevent a React app's scripts from loading on browsers that do not support them?

My current project makes use of create-react-app, where the React script main.js is loaded at the bottom of the <body/> tag. However, it crashes on unsupported browsers upon loading. Above the main.js script block, there is another <script> th ...

Guide on integrating a third-party API with React using Express

I'm facing an issue with my React app trying to make a get request to my Express app, which then sends a get request to a third party API to fetch stock prices. Even though the Express app is logging the correct data, I am getting an empty response fr ...

Loading web pages using Jquery data-role="page"

Currently, I am in the process of developing a web application that utilizes Jquery and consists of multiple pages within a single html document. This is achieved by using a series of data-role="page" elements enclosed within <div> tags. At the mome ...

Utilizing Dojo widgets in Xpages

I'm having trouble applying CSS to certain dojo elements within my Xpage. Here is the CSS style sheet I am using: .formFields { color: rgb(5, 56, 107); font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-style: normal; font-variant: nor ...

Can the tooltip and hover effect be disabled in the pie high chart?

I was able to successfully generate the pie chart displayed below. https://i.sstatic.net/i7jbP.png Currently, I am attempting to remove the tooltip and hover effect on this chart. Here is a link showcasing my progress so far. I have tried various optio ...

Using PHP script to retrieve MySQL table values and dynamically update a live graph in a Javascript function

I've been researching similar issues for quite some time now, but to no avail. Currently, I'm utilizing Highcharts to update a graph every 3 seconds with the latest entry from a specific MySQL table. I am referring to the example Javascript code ...

Store a value in a data container

I am completely new to working with node.js and while I have a basic understanding of its functionality, I believe there is something crucial that I am missing when it comes to how fs.write and buffers work. My goal is to send a user-defined variable over ...

Creating dynamic Ionic slides by fetching data from a database

I am currently experimenting with Ionic. Web development is not my strong suit, so I may be a bit off the mark. However, I would like to retrieve data from an SQLite database and display it on an ion-slide-box. Here is what I have attempted: function sel ...

"Pair of forms and buttons to enhance user experience with Bootstrap and

Experiencing an issue with my webpage that is built using HTML, Bootstrap, and PHP. The page contains two forms: a contact form and a distribution form within a modal. The problem lies within the distribution form as clicking the button only submits the ...

Storing the file name in a database with Node.js

Seeking assistance with a project idea - Is it feasible to develop an application that can scan a directory for all .txt files, extract the filenames, and store them in a database while ensuring no duplicates are saved? Below is the code snippet I have be ...

A guide on sending requests for multipart files using Ajax

This inquiry has been explored multiple times, yet despite attempting various suggestions, I am still unable to get it to function correctly. Essentially, I have an HTML form that initiates a POST multipart file request to the server upon submission: < ...

Tips for retaining the original size of an image in HTML5 canvas drawImage

function getBase64ImageData(_id) { var canv = document.createElement('CANVAS'); var context = canv.getContext("2d"); var imageElem = document.getElementById(_id); context.drawImage(imageElem, 0, 0); var dataURL = canv.toDat ...

Angular elements that function as self-validating form controls

I'm wondering if there's a more efficient approach to achieve this, as I believe there should be. Essentially, I have a component that I want to function as an independent form control. This control will always come with specific validation requi ...

Encountering issues with postback functionality on an ASP.NET webpage while attempting to integrate Google

Creating a small web app using ASP.NET has been going smoothly, until I encountered an issue with LinkButton controls after adding Google Analytics code to one of my pages. Every time I click on a link button, I receive this error message: Microsoft JSc ...

Issues with rendering on the html5 canvas tag's 2d context are preventing it from functioning

I tried integrating the HTML5 canvas tag into my asp.net2010 project to create graph bars, but unfortunately it is not working. Below is the code snippet that I used on my .aspx page, yet it only displays an empty page. I have tested it on updated versions ...

Unsuccessful JASMINE unit test scenario

Having trouble with my function and spec test, as it is failing with the error: Unhandled promise rejection: [object Object] Function: someFunction(a,b,c) { var dfd = q.defer(); this.getInfo(b,c).then((data)=> { //do Something ...

The global class variable encounters an error when trying to assign the value of "socket" to it

Within my class constructor, I am setting up a Socket connection and then storing the socket parameter in a global class variable (this.socket_variable = socket) so that I can access it across all functions in the class. CODE const { Server } = require(&q ...

Menu with dropdown navigation

Looking to create a dynamic and responsive navbar menu with items and subitems on my website. Bootstrap has proven to be challenging when adding submenus. Are there any tools, frameworks, codes or plugins that could assist me in achieving this? It's ...

How can you use Jquery's .data() method to find elements with specific values?

I have a button that generates a new drop pin. The pin is contained within a div, and a hidden form input is also created to store the position of the pin when it's dragged. In my jQuery code for creating these elements, I assign a data attribute call ...