Image overlay on html - html

So I want to add a new part of a website. well its hard to explain... So look at this.
CSS:
.menu-side{
background: #333;
border-right: 1px solid #000;
color: #fff;
position: fixed;
top: 0;
left: -231px;
width: 210px;
height: 100%;
padding: 10px;
}
.menu-side-open{
left:0px;
}
.menu{
overflow-x: hidden;
position: relative;
left: 0px;
}
.menu-open {
left:231px;
}
.menu, .menu-side{
transition: 900ms;
}
.bar {
height: 7px;
width: 25px;
background-color: black;
margin: 2px;
border-radius: 20px;
}
.listing{
text-align: center;
}
.list {
padding: 2px;
color: white;
text-decoration: none;
width: 233px;
}
.list img{
position: absolute;
}
.box:hover {
background-color: gray;
}
body {
background-image: url('download.jpeg')
}
Html:
<header>
<a href="#" class="menu-toggle">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</a>
<nav class="menu-side">
<div class="listing">
<div class="box"><a class="list" href="/"><h1>Home</h1></a> </div>
<div class="box"><a class="list" href="/Photos/"><h1>Photos</h1></a></div>
<div class="box"><a class="list" href="/Store/"><img src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQHEgkUBwgWFgkVFxcbGRgYGSMWHBAeGiQYIiUWHyQfHyosJCYxJxwXIzQtKywsLjEuGCs/OjMsOSg3OjcBCgoKDg0OGxAQGy8kHSQ3LDI3LysvLiwsLi0uNyw0NS83NCw0NCwrNTIsLSwsLDQ0LDQtNCwsLC8yLDctLCwsN//AABEIAEEAQAMBEQACEQEDEQH/xAAcAAEBAQACAwEAAAAAAAAAAAAABwYBCAIDBQT/xAA2EAABAwIBCQQIBwAAAAAAAAABAAIDBBEFBgcSEyExQWFiFEJRsSIjMkORocHRJDVxdIGz4f/EABsBAQACAwEBAAAAAAAAAAAAAAAFBgEDBAcC/8QALhEAAQMDAgUDAwQDAAAAAAAAAAECAwQFERIhIjFBUWFxscFCoeFSgdHwEyMy/9oADAMBAAIRAxEAPwD1VebauweGR9RJFKxnCNzi4Dxs5gvb4qLnpFRNTS6W29xvckMm3ZV9jMArgLKeQK+QeQKGSnZvsttLV02MS+lujkPHpd9CpKkqvoeVK9WbGZ4E9U+UKWpMqQQBAEBLc4eQ2r1lTgsXo75Ixw62/UKNqqX62Fus15ziCdfRfhSaAqOLWarJTJft7opMWvHh+k0C+wzk7mN+66qelV65dyIW53ZtO3RFu/28qfgxbDCJMQkw+kcMOjkLdLeGW2Wv+q1TRYcqtTZDso6tHRxtlcn+RyZx3N1m+y21urpsYl9Zujee90nmuykqs8Dyv3qzaczwJt1T5KQpIqgQBACL79yAlecPIfVaypweL1e+SMcOofZRtVS442Fvs15ziCZd+i/Blcmsa1NTh7sarXmjh0tEG7tXcHd/q1wTq57UeuyHdcKBrYJHQM43YyaOso5co4o3x1nZ8OcbQwjSOs0jbWSaPieJ2bV0va6VvAuG+5EwzQ0U3+1qvkTmv6fCeiGHqYHUj3tmaRI0kfDiFEOarVwpcI5GyNRzeSlNzfZbdo1dPjEvrtzHnv8ASefmpOkqs8DypXqzaMzwJt1Tt5KMpEqoQBAcEXvcbEBKs4eQ/Z9ZU4PF6re9g7vUFGVVLjjaXCzXjViCZd+i/BlMNyhkibSRsIbURnRin0rGFryLtcLWc3jt8F8xVOERvX7HZV2tr5HyKvAu6p1ynZTU5R4ZFXtl1dbpmnY2ONsY03Svdtu4+J2m3ALfUQI5M55e5FWyvdE9G6dnrlVXZERO398GHqqKWhfIyqgc2dli4cWczbdwUW6NzVwpbop45Wo5ioqL9ymZvst+1aumxiT8RuY8+86Tz81JUlVq4Hcyp3qzaMzwJt1Tt59CiKQKsEAQHBGlcOGxAi4JPnDyH7IZKjCIrwHa9g7nUOSjKqmxxNLjZrxrRIJl36L38GTwbG6inYymw2pbHG9/tWDS0usPa4Baoah6Joam69SQrbdTvetRLnDU5J4PfXYuKaJ1PQXL3gdoledN8zh3AT3Ad3iszTI1unm5ea/BrpKJ0kqTO4WNzoanL1X1Pitda1jt8lwk6dmFZTyUIAgCA4c3SBDhcH5oZRcboSTOHkP2IyVGExXpTtewdzqHJRlTTaeNhcrPeElRIJl36L38E+by3KPUsp5Ar5MnZtWU8mCAIAgCA4c0PBDhdp+aGUVUXKEhzhZEHDTJUYTHejO17B7rqHLyUXVU2nibyLpZrwkyJDMvF0Xv+TAgrgLIdnVYzyYIAgCAIAgOHNDwQ8Xad4PFDKKqLlCDZycMiwGubFRbI5YxIG8GkueC0cvRv/KiKqn0LlvIvVmua1EeiX/pNs9/yXpS5RAgCAIAgCAICDZ+fzHD/wBuz+yVc05N2rl+/wDB/9k='><h1>Store</h1></a></div>
</div>
</nav>
</header>
Sorry about the long img src, well ive looked aroung and i found one thing but it didnt work for me. But what i am trying to accomplish is the image in the top right corner. so it would be like an actual banner. I did the position: absolute; but Is there something else? Should i Move the img tag?

Related

When using smooth scroll why does it not scroll to the the area I have specified for it to scroll to?

I am making a website and I have chosen to use smooth scroll.
The smooth scrolling effect works, but if (for example) i chose to scroll down to the 'timeline' section, and then scroll back to 'home', it just stops scrolling midway through the home section. Why is this? Below you can see my webiste.
For example I have set this div as section1 (home):
<div id='section1' class="home-info">
Therefore, i thought that smoothscroll would take me to the top of that div. Turns out it only scrolls through half of it. Why is that???
*{
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
}
html {
scroll-behavior: smooth;
}
a {
color: #AEC6CF;
underline: black;
}
.header{
height: 100px;
background: #f1f1f1;
padding: 0 20px;
color: #000000;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1030;
}
.logo{
line-height: 100px;
float: left;
position: fixed;
top: 0;
z-index: 1030;
}
.menu{
float: right;
line-height: 100px;
position: fixed;
right: 0;
top: 0;
z-index: 1030;
font-size: 20px;
}
.menu a{
color: #000000;
text-decoration: none;
padding: 0 10px;
transition: 0.4s;
}
.show-menu-btn,.hide-menu-btn{
transition: 0.4s;
font-size: 30px;
cursor: pointer;
display: none;
}
.show-menu-btn{
float: right;
}
.show-menu-btn i{
line-height: 100px;
}
.menu a:hover,
.show-menu-btn:hover,
.hide-menu-btn:hover {
color: #AEC6CF;
}
a:link, i {
color: black;
}
i:hover {
color: #AEC6CF;
transition: 0.4s;
cursor: pointer;
}
#chk{
position: absolute;
visibility: hidden;
z-index: -1111;
}
.footer {
left: 0;
bottom: 0;
width: 100%;
background-color: #f1f1f1;
color: black;
text-align: center;
padding-top: 25px;
padding-bottom: 25px;
}
#media screen and (max-width:800px) {
.show-menu-btn,.hide-menu-btn{
display: block;
}
.menu{
position: fixed;
width: 100%;
height: 100vh;
background: #f1f1f1;
right: -100%;
top: 0;
text-align: center;
padding: 80px 0;
line-height: normal;
transition: 0.7s;
}
.menu a{
display: block;
padding: 20px;
}
.hide-menu-btn{
position: absolute;
top: 40px;
right: 40px;
}
#chk:checked ~ .menu{
right: 0;
}
.footer {
left: 0;
bottom: 0;
width: 100%;
background-color: #f1f1f1;
color: black;
text-align: center;
padding-top: 25px;
padding-bottom: 25px;
padding-left: 10px;
padding-right: 10px;
}
.header {
height: 103.5px;
}
.header-info h2 {
font-size: 20px;
margin-top: 350px;
}
.header-info h1 {
font-size: 30px;
}
}
* {
box-sizing: border-box;
}
body {
background-color: #fff;
font-family: Helvetica, sans-serif;
}
/* The actual timeline (the vertical ruler) */
.timeline {
position: relative;
max-width: 1200px;
margin: 0 auto;
}
/* The actual timeline (the vertical ruler) */
.timeline::after {
content: '';
position: absolute;
width: 4px;
background-color: black;
top: 0;
bottom: 0;
left: 50%;
margin-left: -1.2px;
}
/* Container around content */
.container {
padding: 10px 40px;
position: relative;
background-color: inherit;
width: 50%;
}
.header-container {
width: 100%;
position: relative;
background-color: inherit;
padding: 10px 40px;
}
/* The circles on the timeline */
.container::after {
content: '';
position: absolute;
width: 25px;
height: 25px;
right: -17px;
background-color: white;
border: 4px solid #AEC6CF;
top: 15px;
border-radius: 50%;
z-index: 1;
}
/* Place the container to the left */
.left {
left: 0;
}
/* Place the container to the right */
.right {
left: 50%;
}
/* Add arrows to the left container (pointing right) */
.left::before {
content: " ";
height: 0;
position: absolute;
top: 22px;
width: 0;
z-index: 1;
right: 30px;
border: medium solid white;
border-width: 10px 0 10px 10px;
border-color: transparent transparent transparent white;
}
/* Add arrows to the right container (pointing left) */
.right::before {
content: " ";
height: 0;
position: absolute;
top: 22px;
width: 0;
z-index: 1;
left: 30px;
border: medium solid white;
border-width: 10px 10px 10px 0;
border-color: transparent white transparent transparent;
}
/* Fix the circle for containers on the right side */
.right::after {
left: -16px;
}
/* The actual content */
.content {
padding: 20px 30px;
background-color: #f1f1f1;
position: relative;
border-radius: 6px;
transition: 0.4s;
}
/* Media queries - Responsive timeline on screens less than 600px wide */
#media screen and (max-width: 600px) {
/* Place the timelime to the left */
.timeline::after {
left: 31px;
}
/* Full-width containers */
.container {
width: 100%;
padding-left: 70px;
padding-right: 25px;
}
/* Full-width containers */
.header-container {
width: 100%;
padding-left: 25px;
padding-right: 25px;
}
/* Make sure that all arrows are pointing leftwards */
.container::before {
left: 60px;
border: medium solid white;
border-width: 10px 10px 10px 0;
border-color: transparent white transparent transparent;
}
/* Make sure all circles are at the same spot */
.left::after, .right::after {
left: 15px;
}
/* Make all right containers behave like the left ones */
.right {
left: 0%;
}
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='style.css'>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
</head>
<body>
<title>lunAr-creator</title>
<div class="header" id='pronav'>
<div class='logo' id='logo'>
<h1>lunAr-creator</h1>
</div>
<input type="checkbox" id="chk">
<label for="chk" class="show-menu-btn">
<i class="fas fa-bars"></i>
</label>
<ul class="menu" id='navbar'>
Home
About
Timeline
Projects
Useful Links
<label for="chk" class="hide-menu-btn">
<i class="fas fa-times"></i>
</label>
</ul>
</div>
<div style="margin-top:120px">
<div id='section1' class="home-info">
<h2 style='text-align:center;margin-top:350px;font-size:28px;'>Hi there. I'm lunAr-creator!</h2>
<h1 style='text-align:center;padding-top:20px;font-size:40px;love {color:#AEC6CF}'>& I love programming</h1>
<h3 style='text-align:center;padding-top:30px;padding-bottom:480px;'>Projects<i class="fas fa-chevron-down" style='margin-left:20px;'></i></h3>
</div>
<div class='header-container'>
<div id="section3" class="content">
<h2>About<i style='margin-left:20px;color:#AEC6CF;cursor:default;' class="fas fa-address-card"></i></h2>
<p>This is where i will talk about who I am and what i do :D</p>
</div>
</div>
<div class='header-container'>
<div class="content">
<h2>Timeline<i style='margin-left:20px;color:#AEC6CF;cursor:default;padding-bottom:0px;' class="fas fa-child"></i></h2>
<p>The stages I have been through so far with programming.</p>
</div>
</div>
<br></br>
<div class="timeline">
<div class="container right">
<div class="content">
<h2>2016 - 17</h2>
<p>I joined a Scratch coding camp where I learnt some of the foundations of programming.</p>
<br></br>
<p>My Dad built on the knowledge I had already aquired from the course and used C# to teach us some new concepts.</p>
</div>
</div>
<div class="container left">
<div class="content">
<h2>2018-19</h2>
<p>My school introduced me to HTML and CSS where i made my first website - a Minecraft handbook. I started learning Python aswell after it being recommended to me.</p>
<p>Watched a couple of Youtube tutorials on Python, started applying them to small programs and building up my skills.</p>
<br></br>
<p>Made my first (text-based) game called '9-lives'. Used the book: 'Python in easy steps' to help me understand the logic behind it.</p>
</div>
</div>
<div class="container right">
<div class="content">
<h2>2020</h2>
<p>Had lots of spare time on my hands due to Covid. Made some projects such as pong, a simple email client using smtplib, tkinter for the UI and made my second website.</p>
<br></br>
<p>Developed and hosted (and is still hosting) a website for a youth group. I used HTML, CSS and a little Javascript to accomplish this.</p>
<a style='color: #AEC6CF' href="https://a-town-youth.netlify.app">Click here to visit the youth group website</a>
</div>
</div>
<div class="container left">
<div class="content">
<h2>2021</h2>
<p>Created a text-based adventure rpg game for beginners to contribute to (including me). In my opinion it improved my team-working/collaboration skills and helped me learn some new concepts looking at other people code.</p>
<br></br>
<p>Joined GitHub :D </p>
<a style='color: #AEC6CF' href="https://github.com/lunAr-creator">Click here to visit my GitHub</a>
<br></br>
<p>Made my first library (pw-gen) for generating strong randomised passwords.</p>
</div>
</div>
</div>
<br></br>
<div id='section4' class='header-container'>
<div class="content">
<h2>Projects<i style='margin-left:20px;color:#AEC6CF;cursor:default;' class="fas fa-code-branch"></i></h2>
<p>All of my projects are up on my GitHub profile so be sure to check them out</p>
</div>
</div>
<div id='section5' class='header-container'>
<div class="content">
<h2>Useful Links<i style='margin-left:20px;color:#AEC6CF;cursor:default;' class="fas fa-link"></i></h2>
<p>Links to websites and resources that I find helpful whilst I am programming</p>
</div>
</div>
<div id='section6' class='header-container'>
<div class="content">
<h2>Contact<i style='margin-left:20px;color:#AEC6CF;cursor:default;' class="fas fa-pen"></i></h2>
<p>Contact me here for information or collaboration requests</p>
</div>
</div>
<div class='footer'>
<i class="fab fa-github" style='font-size:30px;margin-right:20px;'></i>
<i class="fab fa-stack-overflow" style='font-size:30px'></i>
<br></br>
<p>Copyright © 2021 lunAr-creator - Website Design by me (who else? :D)</p>
</div>
</div>
</body>
</html>

positioning div elements inside each other

There is a weird downward shift of the div's on both sides of the page. Definitely something to do with relative and absolute positioning. I've heard a lot about setting the elements width and height when working with position:absolute and relative but no luck.
Is there a better way of positioning these containers inside each other also, all padding and margin is 0px (stated in body tag).
What it's supposed to look like: !https://imgur.com/a/Yol1Kf8
What I have made so far: !https://imgur.com/a/u4zU4iA
CSS:
#mid-section-container {
position: relative;
height: 800px;
width: 100%;
background-color: white;
}
.apps-container {
position: absolute;
height: 617px;
background-color: black;
}
#monthly-leaderboard {
right: 50px;
top: 50px;
}
#tournament-board {
width: 800px;
top: 50px;
left: 50px;
}
.boards-container-nav {
background-color: #363636;
border-bottom: solid 2px #25b6e6;
}
#monthly-leaderboard-header {
height: 85px;
}
#tournament-header {
width: 100%;
height: 85px;
}
.apps-content-container {
height: 80%;
margin: 0px 10px;
background-color: #252525;
border-radius: 7px;
}
#monthly-content {
width: 286px;
}
#tourn-content {
width: 780px;
}
HTML:
<div id="mid-section-container">
<div id="monthly-leaderboard" class="apps-container">
<div id="monthly-leaderboard-header" class="boards-container-nav">
<h1>Monthly Leaderboard</h1>
</div>
<div id="monthly-content" class="apps-content-container">
<div id="monthly-content-header" class="boards-content-nav">
<ul>
<li>Rank</li>
<li>User</li>
<li>Wins</li>
</ul>
</div>
<p>content goes here.</p>
<p>and here.</p>
</div>
</div>
<div id="tournament-board" class="apps-container">
<div id="tournament-header" class="boards-container-nav">
<ul>
<li>Current</li>
<li>Upcoming</li>
</ul>
</div>
<div id="tourn-content" class="apps-content-container">
<div id="tourn-content-header" class="boards-content-nav">
<ul>
<li>Platform</li>
<li>Torunament</li>
<li>Start Time</li>
<li>Teams</li>
</ul>
</div>
</div>
</div>
</div>
Try this one it is help full
#mid-section-container {
position: relative;
height: 800px;
width: 100%;
background-color: white;
}
.apps-container {
position: absolute;
height: 617px;
background-color: black;
}
#monthly-leaderboard {
right: 50px;
top: 50px;
}
#tournament-board {
width: 800px;
top: 50px;
left: 50px;
}
.boards-container-nav {
background-color: #363636;
border-bottom: solid 2px #25b6e6;
}
#monthly-leaderboard-header h1{
margin: 0;
padding: 10px 10px;
color: #FFF;
}
#tournament-header {
width: 100%;
}
.apps-content-container {
height: 80%;
margin: 0px 10px;
background-color: #252525;
border-radius: 7px;
}
#monthly-content {
width: 286px;
}
#tourn-content {
width: 780px;
}
ul li {
display: inline-block;
width: auto;
}
ul li a{
color: #FFF;
}
ul li {
color: #FFF;
}
#tournament-header ul li a{
padding: 10px 20px;
}
#tourn-content-header ul li{
padding: 10px 20px;
}
#monthly-content-header ul li{
padding: 10px 20px;
}
#monthly-content-header{
background-color: #404040;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
}
#tourn-content-header{
background-color: #404040;
border-top-right-radius: 10px;
border-top-left-radius: 10px;
}
<div id="mid-section-container">
<div id="monthly-leaderboard" class="apps-container">
<div id="monthly-leaderboard-header" class="boards-container-nav">
<h1>Monthly Leaderboard</h1>
</div>
<div id="monthly-content" class="apps-content-container">
<div id="monthly-content-header" class="boards-content-nav">
<ul>
<li>Rank</li>
<li>User</li>
<li>Wins</li>
</ul>
</div>
<p>content goes here.</p>
<p>and here.</p>
</div>
</div>
<div id="tournament-board" class="apps-container">
<div id="tournament-header" class="boards-container-nav">
<ul>
<li>Current</li>
<li>Upcoming</li>
</ul>
</div>
<div id="tourn-content" class="apps-content-container">
<div id="tourn-content-header" class="boards-content-nav">
<ul>
<li>Platform</li>
<li>Torunament</li>
<li>Start Time</li>
<li>Teams</li>
</ul>
</div>
</div>
</div>
</div>
there is a unnecessary use of position:absolute; i have made changes in your code and removed unwanted css.
#mid-section-container {
position: relative;
height: 800px;
width: 100%;
background-color: white;
display:flex;
}
.apps-container {
height: 617px;
background-color: black;
}
.boards-container-nav {
background-color: #363636;
border-bottom: solid 2px #25b6e6;
}
#monthly-leaderboard-header {
height: 85px;
}
#tournament-header {
width: 100%;
height: 85px;
}
.apps-content-container {
height: 80%;
margin: 0px 10px;
background-color: #252525;
border-radius: 7px;
}
#tournament-board {
width: 70%;
}
#monthly-leaderboard {
width: 30%;
margin-left:20px;
}
<div id="mid-section-container">
<div id="tournament-board" class="apps-container">
<div id="tournament-header" class="boards-container-nav">
<ul>
<li>Current</li>
<li>Upcoming</li>
</ul>
</div>
<div id="tourn-content" class="apps-content-container">
<div id="tourn-content-header" class="boards-content-nav">
<ul>
<li>Platform</li>
<li>Torunament</li>
<li>Start Time</li>
<li>Teams</li>
</ul>
</div>
</div>
</div>
<div id="monthly-leaderboard" class="apps-container">
<div id="monthly-leaderboard-header" class="boards-container-nav">
<h1>Monthly Leaderboard</h1>
</div>
<div id="monthly-content" class="apps-content-container">
<div id="monthly-content-header" class="boards-content-nav">
<ul>
<li>Rank</li>
<li>User</li>
<li>Wins</li>
</ul>
</div>
<p>content goes here.</p>
<p>and here.</p>
</div>
</div>
</div>
Please update following css into your existing css. just add max-width: 1250px; you want. and margin: 0 auto;
#mid-section-container {
position: relative;
height: 800px;
width: 100%;
background-color: white;
max-width: 1250px;
margin: 0 auto;
}
add css
#mid-section-container{
display:flex;
}
#monthly-leaderboard{
width:70%;
height:100%;
}
#tournament-board{
width:30%;
height:100%;
}
also add relevant properties of flex
may be this is the best way to position divs

Why isn't z-index working here?

I want the webdsn-drop to be behind the #navbuttons-container but I can't get it to work. For some reason #navbuttons-container div is behind it #webdsn-drop and I want these layers reversed.
body {
background-color: #0f0f0f;
width: 980px;
margin: 0 auto;
}
/*-----NAVIGATION-BAR-----*/
#navbuttons-container {
background-color: #303030;
width: 100%;
overflow: auto;
position: fixed;
left: 0px;
top: 0px;
overflow: hidden;
padding: 0;
z-index: 10;
}
#web-name {
color: #f7f7f7;
font-family: 'calibri light';
padding: 4.5px 0 0 10px;
float: left;
font-size: 30px;
margin: 0 auto;
letter-spacing: 10px;
}
#navigation {
max-width: 980px;
min-width: 854px;
margin: 0 auto;
}
.navbuttons {
float: right;
font-size: 20px;
font-family: 'calibri';
display: flex;
}
.navbuttons a {
color: #f7f7f7;
text-decoration: none;
padding: 12.5px 20px;
background-color: #303030;
transition: background-color 0.5s ease;
}
.navbuttons a:hover {
background-color: #5b5b5b;
transition: background-color 0.5s ease;
}
#webdsn-drop {
position: fixed;
left: 0px;
background-color: red;
width: 100%;
z-index: 9;
}
<div id="navbuttons-container">
<div id="navigation">
<h1 id="web-name">PORTFOLIO</h1>
<div class="navbuttons-container">
<div class="navbuttons">
Logo Design
<div id="webdsn-drop">
<h1 class="subname">
<h1>
</div>
</div>
<div class="navbuttons">
Art & Misc.
<div id="webdsn-drop">
<h1 class="subname">
<h1>
</div>
</div>
<div class="navbuttons">
Posters & Flyers
<div id="webdsn-drop">
<h1 class="subname">
<h1>
</div>
</div>
<div id="webdsn-menu" class="navbuttons">
Website Design
<div id="webdsn-drop">
<h1 class="subname">WEBSITE DESIGN
<h1>
</div>
</div>
</div>
</div>
</div>
Apply z-index: -1; to .webdsn-drop- since it's a child element of #navbuttons-container, you need to use a negative z-index in order to move it behind the parent.

How do I position a div after the others?

So I have multiple divs. Like this:
<div id="LeftContent"></div>
<div id="RightContent"></div>
And so on. My goal is to create a centered div after all that. When I try to, I end up with the div being in the empty spaces between the 'left' and 'right' divs. An answer with some CSS code would be most appreciated.
HTML5:
<!doctype html>
<html>
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="css/style.css">
<head>
<meta charset="utf-8">
<title>OneClickLearn</title>
</head>
<body>
<aside>
<br>
<nav>
<ul>
<li>Home</li>
<hr>
<li>Learn HTML</li>
<li>Learn CSS</li>
<li>Learn the Basics of Web Design</li>
<hr class="nav">
<li>Learn PHP</li>
<li>Learn JAVASCRIPT</li>
</ul>
</nav>
</aside>
<a id="nav-toggle" href="#" class="position"><span></span></a>
<main>
<header>
<div href="#" class="container">
<h1 class="title">OneClickLearn</h1>
</div>
</header>
</main>
<div class="header">
<div class="content">
<h1 class="large">Welcome To OneClickLearn</h1>
<hr class="hr">
<h2>A website for web developers everywhere</h2>
</div>
</div>
<div class="left">
<h1>What you can do with us</h1>
<h3>OneClickLearn offers several web design courses, as well as tools like Cascading Style Sheet libraries, and special colors to use for your website! Unlike some other coding websites, OneClickLearn is absolutely free!</h3>
<a class="abutton"><button>Learn More</button></a>
</div>
<div>
<div class="right">
<h1>CSS Libraries</h1>
<h3>What's a CSS Library? Simple. This tool is made for web developers who are advanced in website functionality, but maybe not so great in what we would call, 'the pretties'. A CSS library is all the tools in design you need-- waiting for you on the web.</h3>
<a class="abutton"><button>Learn More</button></a>
<a class="abutton"><button class="buttonop">Get Ocelot.css</button></a>
</div>
</div>
<div class="left">
<h1>Courses</h1>
<h3>All our courses (so far!) are based off of web design. With these courses, you learn the basics of HTML5, CSS3, and more languages coming soon. Also, you can learn our Cascading Style Sheet libraries' functions. If you have any reccomendations, just email us down below</h3>
<a class="abutton"><button>Email Us</button></a>
<a class="abutton"><button class="buttonop">Learn More</button></a>
</div>
<div class="div">
<h1>Having trouble with your website?</h1>
<h3>We'll see what we can do.</h3>
<button class="abutton">Contact Us</button>
</div>
</body>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script>
<script src="js/nav.js"></script>
</html>
CSS:
#import url('https://fonts.googleapis.com/css?family=Open+Sans');
.div {
clear: both;
margin: 0 auto;
height: 100px;
width: 600px;
text-align: center;
}
.greyback {
background-color: #4B4949;
}
.nav {
background-color: #bdc3c7;
}
.denied {
color: #bdc3c7;
}
.denied:hover {
cursor: not-allowed;
}
body {
size: 100%;
display: cover;
margin: 0;
padding: 0;
}
p a {
color: #27ae60;
text-decoration: none;
}
p a:hover {
color: #27ae60;
text-decoration: underline;
cursor: pointer;
}
.header {
color: white;
width: 100%;
height: 300px;
background-color: #2980b9;
}
.content {
margin-top: 70px;
padding-top: 60px;
text-align: center;
}
.large {
font-size: 40px;
}
.hr {
width: 100px;
}
.left {
margin: 20px;
float: left;
height: auto;
width: 50%;
color: #4B4949;
}
.right {
margin: 20px;
float: right;
height: auto;
width: 50%;
color: #4B4949;
}
a {
color: #2AABAD;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.side {
margin: 20px;
}
.img {
display: inline-block;
}
button {
background-color: #2980b9;
border: none;
border-radius: 5PX;
height: 40px;
width: auto;
color: white;
}
button:hover {
background-color: #3498db;
cursor: pointer;
}
.abutton {
color: none;
text-decoration: none;
}
.buttonop {
background-color: #3498db;
border: none;
border-radius: 5PX;
height: 40px;
width: auto;
color: white;
}
.buttonop:hover {
background-color: #2980b9;
cursor: pointer;
}
.main {
width: 100%;
text-align: center;
}
.main-content {
display: inline-block;
}
P.S. I am using float:left; and float:right; for the left and right divs :)
Thanks :) (If I need any elaboration please let me know)
I'm not 100% clear on what you are asking, but you could try something like the following:
Html
<div id="LeftContent"></div>
<div id="RightContent"></div>
<div id="CentredDiv"></div>
CSS
div {
border: 1px solid #f0f;
height: 50px;
box-sizing: border-box;
width: 400px;
}
#LeftContent,
#RightContent {
float: left;
}
#CentredDiv {
width: 800px;
clear: left;
}
Yeah, not totally sure what you want, but maybe something like this?
#CenteredContent {
clear: both;
margin: 0 auto;
height: 100px;
width: 100px;
background-color: red;
}
What I understand from your question is that you need a centered div. You can do this to achieve centered div.
HTML:
<div class="centered-div">
Some Content
</div>
CSS:
.centered-div {
width: 400px;
min-height: 400px;
margin: 0 auto;
clear: both;
}
I hope that helps :)

Reduce clickable area for an image

I've created a left navigation bar using buttons. I'm trying to reduce the hyperlink area to just the background image. Also, another issue I'm having is the elements overlaying the background image are taking precedence over the hyperlink, so the button is not actually clickable. Page for reference
http://www.auburn.edu/administration/facilities/home-page/index.html
Hyperlink area
Here's the background image area
.img-responsive {
display: block;
padding: 0;
margin: 0;
}
.background:hover .head {
color: #d76e08;
}
.overlay {
position: absolute;
z-index: 1;
top: 0;
left: 0;
color: white;
}
.icon {
padding-top: 15px;
padding-left: 40px;
}
.head {
margin-top: -75px;
padding-left: 120px;
}
.content {
margin-top: -5px;
padding-left: 120px;
padding-right: 35px;
}
<div class="row">
<div class="col-sm-12">
<div class="background">
<a href="../Collin/misc/issues/index.html">
<img alt="background" class="img-responsive" src="buttons/images/button.png" />
</a>
<div class="overlay">
<div class="icon">
<img alt="test" class="img-responsive" src="buttons/images/info-icon.png" />
</div>
<p class="head">Ask Facilities</p>
<p class="content">Here will be text about the button. .</p>
</div>
</div>
</div>
</div>
I'm trying to reduce the hyperlink area to just the background image.
Your markup is incredibly complex for what you are displaying.
You could have something like:
<ul>
<li>
<a>
<h2></h2>
<p></p>
</a>
</li>
<li>
<a>
<h2></h2>
<p></p>
</a>
</li>
</ul>
and add the image and the gradient using CSS.
I would use a single link tag for your button and leverage CSS gradients for the background:
* {
box-sizing: border-box;
}
body {
font-family: sans-serif;
}
.button {
background-image: linear-gradient(to bottom, #3D85C6, #07355F 50%, #07355F);
background-size: 100% 200%;
border-radius: 4px;
color: #fff;
display: block;
padding: 10px;
text-decoration: none;
transition: all 150ms ease-in-out;
}
.button:hover,
.button:focus,
.button:active {
background-position: 0 50%;
}
.button-icon {
float: left;
margin-right: 15px;
}
.button-content {
overflow: hidden;
}
.button-title {
font-size: 18px;
font-weight: bold;
}
.button-description {
font-size: 16px;
}
<a class="button" href="../Collin/misc/issues/index.html">
<div class="button-icon">
<img src="http://satyr.io/72/white?brand=github" alt=""/>
</div>
<div class="button-content">
<p class="button-title">Ask Facilities</p>
<p class="button-description">Here will be text about the button…</p>
</div>
</a>
Also here http://jsbin.com/rikisemawe/edit?html,css,output
The elements in OP were stacked in the markup, there were no nested components of the button. That would explain the unusual position coords and large padding.
Instead of <img>, background-image is used. Changed some of the tags to a real <button>, <h4> instead of <p>, etc.
SNIPPET
.button {
position: relative;
min-width: 350px;
max-width: 100%;
min-height: 95px;
height: auto;
padding: 5px 10px;
border: 0 none transparent;
border-radius: 6px;
background: url(http://www.auburn.edu/administration/facilities/home-page/buttons/images/button.png)no-repeat;
background-size: cover;
}
.background:hover .head {
color: #d76e08;
}
.text {
padding: 0 5px;
position: absolute;
left: 85px;
top: 5px;
text-align: left;
color: #def;
text-decoration: none;
}
.button:hover,
.text:hover {
text-decoration: none;
color: #def;
}
.button:hover .head {
color: gold;
}
.icon {
width: 75px;
height: 75px;
position: absolute;
top: calc(50% - 37.5px);
background: url(http://www.auburn.edu/administration/facilities/home-page/buttons/images/service-icon.png)no-repeat;
}
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="row">
<div class="col-sm-12">
<button class="button">
<div class="icon"></div>
<a class='text'>
<h4 class="head">Ask Facilities</h4>
<p class="content">Here will be text about the button.</p>
</a>
</button>
</div>
</div>