"Stylish social media buttons affixed to the top of an HTML and CSS

Struggling to position three social media buttons on my page, but they keep appearing at the top of the page. I want them in a straight line centered within the header. No matter what I try, the icons remain stuck at the top.

<!DOCTYPE html>
<HEAD>
<TITLE> FEEL THE GAME </TITLE>

<LINK href="to.css" rel="stylesheet" type="text/css">

</HEAD>

<body>
<div id="header">

<div class="icons">
<a class="fb-link" href="#">
<img src="facebook-64.png">
</a>
<a class="twr-link" href"#">
<img src="twitter-64.png">
</a>
<a class="inst-link" href"#">
<img src="instagram-64.png">
</a>
</div>

<img src="logo2.png">

<div id="nav">
<div id="nav_wrapper">
<ul>
<li><a href="#">HOME</a>

</li>
</li>
<li> <a href="#">dropdown #1</a>

<ul>
<li><a href="#">dropdown #1 item #1</a>

</li>
<li><a href="#">dropdown #1 item #2</a>

</li>
<li><a href="#">dropdown #1 item #3</a>

</li>
</ul>
</li>
<li> <a href="#">dropdown #2</a>

<ul>
<li><a href="#">dropdown #2 item #1</a>

</li>
<li><a href="#">dropdown #2 item #2</a>

</li>
<li><a href="#">dropdown #2 item #3</a>

</li>
</ul>
</li>
</li>
</ul>
</div>
<!-- Nav wrapper end -->
</div>
</div>
</div>
<div id="wrapper">
<div id="content_area">
<p></p>
</div>
</div>
<DIV ID="footer"></DIV>

<center>
<video width="900" height="550" controls  >
<source src="fifa.mp4" type="video/mp4">
<source src="fifa.ogg" type="video/ogg">
<source src="fifa.webm" type="video/webm">
<object data="fifa.mp4" width="320" height="240">
<embed src="fifa.swf" width="320" height="240">
</object> 
</video>
</center>

</BODY>

</HTML>

CSS

body {
margin:0;
padding:0;
min-width:525px;
font-family: Arial;
font-size: 17px;
background-image:url('fifa2.jpg');
}

#header {
float: left;
width: 100%;
height: 100px;
position: absolute;
background-image:url('purty_wood.png');

}

#footer {
float: left;
width: 100%;
background-image:url('classy_fabric.png');
font-size: 14pt;
font-weight: bold;
text-align: center; 
position: absolute;
height: 40px;
left: 0px;
bottom: 0px;
}

#wrapper {
padding-left: 200px;
padding-right: 200px;
overflow: hidden;
}


#content_area {
position: relative;
float: left;
width: 100%;
padding-bottom: 2000px;
margin-bottom: -2000px;
}


#nav {
background-image:url('classy_fabric.png');
margin-top: 68px;
}
#nav_wrapper {
width: 335px;
margin: 0 auto;
text-align: left;
}
#nav ul {
list-style-type: none;
padding: 0;
margin: 0;
position: relative;
min-width: 200px;
}
#nav ul li {
display: inline-block;
}
#nav ul li:hover {
background-color: #333;
}
#nav ul li a, visited {
color: #CCC;
display: block;
padding: 15px;
text-decoration: none;
}
#nav ul li:hover ul {
display: block;
}
#nav ul ul {
display: none;
position: absolute;
background-color: #333;
border: 5px solid #222;
border-top: 0;
margin-left: -5px;
}
#nav ul ul li {
display: block;
}
#nav ul ul li a:hover {
color: #699;
}


img{
position:absolute;  
right: 640px;
top: -50px; 
}

video {
margin-top: 250px;
}

.fb-link, .twr-link, .inst-link {
display:block; 
width:64px; 
margin-left:20px; 
}
.fb-link{
margin-left:0; 
}

![My page icons stuck top of the page][1]

Answer №1

Check out this solution that should resolve your issue:

View it on Fiddle

Your previous code included unnecessary absolute positioning, which caused problems with other images on the website. It's crucial to be mindful of these issues to avoid conflicts.

The updated code below should fix the errors present in your original code, such as unclosed divs and lists:

<!DOCTYPE html>
<head>
<title> FEEL THE GAME  </title>
<link href="to.css" rel="stylesheet" type="text/css">
</head>

<body>
    <div id="header">
        // Continue with the remaining HTML code...
        // Please refer to the original text for the complete code
      
Hopefully, this solution assists you with enhancing your webpage!</p>
  </div></answer1>
<exanswer1><div class="answer accepted" i="25472064" l="3.0" c="1408871507" m="1408888365" a="ZGluZ29fZA==" ai="629127">
<p>This revised code snippet is intended to address your concerns</p>

<p><a href="http://jsfiddle.net/p63om2r2/" rel="nofollow">Fiddle Link</a></p>

<p>You had numerous instances of unnecessary absolute positioning. Placing your <code>img elements in an absolute position impacted all images across the site. It's essential to exercise caution regarding this behavior.

By utilizing the following corrected code, you should rectify the issues found in your initial code, including unmatched divs and lists:

<!DOCTYPE html>

<head>
<title> FEEL THE GAME  </title>
<link href="to.css" rel="stylesheet" type="text/css">
</head>

<body>
    <div id="header">
        <div class="icons">
            <a class="fb-link" href="#">
                <img src="facebook-64.png" />
            </a>
            <a class="twr-link" href"#">
                <img src="twitter-64.png" />
            </a>
            <a class="inst-link" href"#">
                <img src="instagram-64.png" />
            </a>
        </div>
        <img src="logo2.png" />
        <div id="nav">
            <div id="nav_wrapper">
                <ul>
                    <li><a href="#">HOME</a></li>
                    <li><a href="#">dropdown #1</a>
                        <ul>
                            <li><a href="#">dropdown #1 item #1</a></li>
                            <li><a href="#">dropdown #1 item #2</a></li>
                            <li><a href="#">dropdown #1 item #3</a></li>
                        </ul>
                    </li>
                    <li><a href="#">dropdown #2</a>
                        <ul>
                            <li><a href="#">dropdown #2 item #1</a></li>
                            <li><a href="#">dropdown #2 item #2</a></li>
                            <li><a href="#">dropdown #2 item #3</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
            <!-- Nav wrapper end -->
        </div>
    </div>
    <div id="wrapper">
        <div id="content_area">
            <p></p>
        </div>
    </div>

    <center>
    <video width="900" height="550" controls>
        <source src="fifa.mp4" type="video/mp4" />
        <source src="fifa.ogg" type="video/ogg" />
        <source src="fifa.webm" type="video/webm" />
        <object data="fifa.mp4" width="320" height="240">
            <embed src="fifa.swf" width="320" height="240" />
        </object> 
    </video>
    </center>
    <div id="footer"></div>
</body>
</html>

Don't forget to validate your site here to ensure compliance with standards. Address any missing alt tags for images and refrain from using outdated practices like <center>.

We hope this guidance proves beneficial.

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

Trouble with Sass Imports in conjunction with BootStrap5 on ASP.NET Core MVC platform

As I delve into using Scss for Bootstraps 5, a new issue has arisen that I am struggling to resolve with the help of internet resources. Initially, I successfully compiled and made changes to my Sass file when importing the following declarations: @import ...

The element fails to appear on screen when using Firefox

Check out this site using IE or Chrome and pay attention to the yellow block: Then, try opening the same page in Firefox and watch as the block mysteriously vanishes. Does anyone have any idea why this is happening? Did I make a mistake somewhere? ...

Tips for aligning the list style icon perfectly with the text

I need help aligning text in the center of a customer list style image for an LI element. I've attempted using margins and paddings, but it hasn't worked. Here's the code and screenshot: HTML: <ul class="homeList"> <li>Over ...

Return to the previous location on the page when clicking the browser's back button

I'm looking to incorporate the following functionality: When on page a, clicking a link takes me to page b and displays all content from the beginning. Pressing the browser back button should then return me to page a and show the content starting fro ...

Media queries are behaving incorrectly, causing them to trigger when regular CSS should be applied, and vice versa

When I switch to laptop/desktop view, the regular CSS styles are being overridden in the inspect element, and the query styles are taking precedence. Can anyone explain why this is happening? For instance, let's take a look at the code for the nav se ...

Tips for handling CSS loading delays with icons in OpenLayers markers

When using openlayers (v4.6.4) with font-awesome as marker icons, the icons do not display upon first load (even after clearing cache and hard reload). Instead, I see a rectangle resembling a broken character. It is only on the second load that they appear ...

html navigation bar is not functioning as intended in my webpage

I'm facing an issue with my navbar menu. I implemented some JavaScript code to make the navbar sticky while the user scrolls, but it's not working as expected. The navbar is not staying sticky when the page is scrolled. Could someone please revi ...

Creating multiple div columns dynamically with jQuery

Check out the code snippet below: <div id="container"> <div class="b">test1</div> <div class="b">test2</div> <div class="b">test3</div> <div class="b">test4</div> <div class="b"& ...

utilizing a Bootstrap modal element throughout multiple HTML documents

I have a bootstrap modal dialog div that I want to use in all 4 html pages of my web application without repeating the code. I have a common JavaScript file for this purpose. What is the best way to achieve this? <!-- Modal --> <div class="modal ...

It is not possible to invoke a function within the mounted() lifecycle hook

I recently integrated a chat API into my Vue.js project for connecting to chat rooms. Upon entering a chat room page, an ajax request is triggered which then calls a function responsible for fetching the complete chat history: mounted() { $.ajax({ url: ...

What is the best way to showcase a table below a form containing multiple inputs using JavaScript?

Context: The form I have contains various input fields. Upon pressing the [verify] button, only the "first name" is displayed. My goal is to display all input fields, whether empty or filled, in a table format similar to that of the form. Exploration: ...

What is the best way to specifically target header elements within article elements using a CSS selector?

As someone who is not well-versed in CSS, I am looking to target specifically the header elements within article elements. I have some understanding of selectors such as #, ., or ,. article header article, header article.header article#header I believe t ...

Arranging divs with HTML and CSS

I am currently facing issues with the positioning of 3 scripts in my HTML file. The vertical gauge is overlapping the second circular gauge, despite trying different positioning options to no avail. How can I adjust the layout so that the vertical gauge a ...

The dropdown menu is extending outside the header in a right-to-left (RTL) direction

I have implemented the jQuery code below to prevent the dropdown from extending beyond the header area. It works perfectly in the normal LTR version. However, I need a solution for the RTL version. How can I achieve this? jQuery $('.primary-menu .dr ...

I am in search of a specialized 3D camera with a unique effect

I am seeking assistance with animating a camera to replicate or closely resemble the effect seen in this demo: Any help would be greatly appreciated. ...

Firefox causing images to have a white border after rendering

My image (.png) has a white border only in Firefox, despite the CSS border property being set to 0. Is there a solution to remove this unwanted border around the image? ...

A two-column layout utilizing the full height feature in Bootstrap 5, excluding the use of cards within the

I am currently attempting to create a two-column full-height page without using cards. Instead, I want to include a significant amount of text, links, and buttons in both columns. I am uncertain if this is achievable with Bootstrap columns. If anyone knows ...

What is the best way to implement a clickable grid row using CSS?

My grid layout consists of 1 row and 4 columns, with the row occupying 85% of the width. I want the entire row to change color when hovered over and be clickable to access another page. Currently, the row changes colors when hovered over and is clickable, ...

My website doesn't seem to support Javascript, although it works perfectly on jsfiddle

I was tinkering around on jsfiddle and managed to get my code working flawlessly. However, when I tried to copy and paste it elsewhere, the functionality broke down. It seems that for some inexplicable reason, the code doesn't seem to pass through the ...

two separate .Click() functions operating in unison rather than independently - jquery

After selecting the filter tabs, they work perfectly fine but always scroll the page to the top. Can someone please take a look at the code below and point out what mistake I've made in it? On the other hand, the Back-to-Top function is working as in ...