Can't get my Aside element to format properly - html

I am unable to get my aside element to align properly with the rest of my page. It sits above the main element and spills into the header. How do I fix that?
Here's what it looks like on the page:
Here's the CSS Style code I'm using:
* {
margin:0;
padding:0;
}
body {
font-size:1.1em;
font-family: Arial, Helvetica, sans-serif;
background-color:darkseagreen;
}
header {
padding: 1%;
margin-bottom: 3%;
text-align: center;
font-size:2em;
font-family: Arial, Helvetica, sans-serif;
text: white;
background-color: #4EEE94;
}
aside {
width: 25%;
padding: 0.5%;
margin: 0 5px 5px 0;
background-color: #1C86EE;
float: right;
border-radius: 20px;
position: relative;
min-height: 100%;
display: block;
}
#main {
width: 446px;
margin-right: 27%;
padding: 0.5%;
background-color: #EE6363;
text: white;
position: relative;
border-radius: 4%;
}
.map {
padding: 2em;
margin: 3em auto 3em auto;
position: relative;
display: block;
text-align: center;
width: 95%;
.image {
padding: 5%;
margin: 4em;
float: left;
position: relative;
left: 10px;
top: 15px;
}
}
div {
box-shadow: 10px 10px 5px #888888;
border: 2px solid;
border-radius: 25px;
}
nav ul li {
margin-right: 1em;
display: inline;
list-style-type: none;
}
nav li a {
padding: 1em;
color: white;
text-decoration: none;
}
nav li a:hover {
color: yellow;
text-decoration: underline;
}
footer {
margin: 0.5% 27% 0 0;
border-top: solid thick teal;
padding: 0.5%;
background-color: lime;
}

first issue with your css remove the braces after .image class.
.image {
padding: 5%;
margin: 4em;
float: left;
position: relative;
left: 10px;
top: 15px;
}
}
second thing use px or % or em do not use all (recommended) .
Third use id something like this
<div id="xyz"></div>
Not <div id="#xyz"></div> # is the css selector
also do not use multiple id like <div id="abc xyz"></div> u cannot use multiple id's use class instead of <div class="abc xyz"></div>

Related

Heading not staying in the absolute position when screen is resized

I'm trying to create a description box for a website in React. The image below is the desired look:
but when I resize the screen to be large, the h1 tag doesn't seem to hold its absolute position anymore. I would like the box to resize like it has with the screen but the "Project 1" title should stay in the same place.
The CSS code to produce the images is:
body {
font-family: sans-serif;
margin: 0 auto;
padding: 25px;
max-width: 800px;
min-width: 400px;
background-color: #e0e0e0;
text-align: center;
}
.card {
position: relative;
padding: 25px 0px;
background-color: #ffffff;
margin: 50px 0;
text-align: left;
}
.top {
height: 100px;
width: 100%;
background-color: #69143a;
position: absolute;
top: 0;
left: 0;
display: flex;
}
h1 {
position: relative;
display: flex;
}
.name {
font-size: 2em;
color: #ffffff;
display: flex;
flex: 1;
margin: 10% 25px 0;
}
.supervisor {
font-size: 1em;
margin: 20px 20px;
color: #353535;
}
.bottom {
margin-top: 100px;
margin-left: 20px;
margin-right: 20px;
margin-bottom: 10px;
color: #353535;
}
.info {
margin: 20px 20px;
}
.subjects {
margin: 20px 20px;
font-style: italic;
}
and the React component is:
function Project(props) {
return (
<div className="card">
<div className="top">
<h2 className="name">{props.title}</h2>
</div>
<div className="bottom">
<h4 className="supervisor">Supervisor: {props.supervisor}</h4>
<p className="info">{props.description}</p>
<p className="subjects">Prerequisites: {props.subjects}</p>
</div>
</div>
)
}
Any help would be greatly appreciated - been banging my head on the wall all day trying to get it to format correctly.
The root of the issue is the dynamic margin you had set on .name. You can remove that and also remove the position: absolute; and exchange it with relative. Then remove the top padding on .card and you are good to go.
body {
font-family: sans-serif;
margin: 0 auto;
padding: 25px;
max-width: 800px;
min-width: 400px;
background-color: #e0e0e0;
text-align: center;
}
.card {
position: relative;
padding: 0px 0px 25px 0px;
background-color: #ffffff;
margin: 50px 0;
text-align: left;
}
.top {
width: 100%;
background-color: #69143a;
position: relative;
top: 0;
left: 0;
text-align: center;
}
h1 {
position: relative;
display: flex;
}
.name {
font-size: 2em;
color: #ffffff;
padding: 30px;
}
.supervisor {
font-size: 1em;
margin: 20px 20px;
color: #353535;
}
.bottom {
margin-top: 100px;
margin-left: 20px;
margin-right: 20px;
margin-bottom: 10px;
color: #353535;
}
.info {
margin: 20px 20px;
}
.subjects {
margin: 20px 20px;
font-style: italic;
}
<div class="card">
<div class="top">
<h2 class="name">{props.title}</h2>
</div>
<div class="bottom">
<h4 class="supervisor">Supervisor: {props.supervisor}</h4>
<p class="info">{props.description}</p>
<p class="subjects">Prerequisites: {props.subjects}</p>
</div>
</div>

CSS: Slider overlaps Drop down Menu on Mobile - Z-Index issue?

Update:
I'm sure this will be easy fix for advanced members. I have created drop down menu with the 'nav' element. For some reason as hard as I try, I cannot get the menu to overlap the slider images below it when you expand it on mobile. I've tried lowering the Z-index on the slider and raising it on the menu. What am I doing wrong? Thanks in advance:
UPDATE: Here is a fiddle link as requested by a comment which includes the HTML. https://jsfiddle.net/wknow6cv/#&togetherjs=ADxkd31O6q
#import 'https://fonts.googleapis.com/css?family=Alegreya+Sans';
* {
margin: 0;
padding: 0;
border: 0;
overflow-x: hidden;
}
html,body
{
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
}
body {
background: #F5F5F5;
color: #67727A;
font-family: 'Alegreya', Sans-serrif;
margin: 0;
}
h3 {
font-size: 150%;
line-height: 155%;
padding: 5% 0;
font-weight: 400;
}
p{
font-size: 120%;
line-height: 150%;
padding: 3%;
text-indent: 2%;
text-align: center;
}
img{
max-width: 100%;
height: auto;
width: auto;
margin-bottom: -4px;
}
header{
background-color: #6991AC;
width: 100%;
height: 120px;
}
h1{
position:absolute;
right: 600px;
top:30px;
}
#top-left-menu {
right: 0px;
}
#logo{
margin: 20px;
float: left;
width: 380px;
height: 60px;
background: url(img/RD.png) no-repeat center;
left: 0px;
top: 0px;
}
p {
font-size: 1.4vw;
}
h3{
font-size: 1.5vw;
}
/*--- Start Navigation --*/
nav{
float: right;
padding: 25px 20px 0 0; /*--top right bottom left--*/
}
#menu-icon{
display: hidden;
width: 40px;
height: 40px;
background: url(img/nav.png) center;
}
a:hover#menu-icon {
border-radius: 4px 4px 0 0;
}
ul{
list-style-type: none;
}
nav ul li {
font-family: 'Alegreya Sans', Sans-serrif;
font-size: 150%;
display: inline-block;
/*makes the links go left from right instead of up and down*/
float: left;
padding: 10px;
}
nav ul li a {
text-decoration: none;
color: #F5F5F5;
}
nav ul li a:hover {
color: #C3D7DF;
}
/*.current{
color: #C3D7DF;
}
/*--End Navigation--*/
.one-fourth {
width: 25%;
float: left;
text-align: center;
font-family: Arial;
color: #F0F0F0;
}
#cloud {
background-color: #C3D7DF;
}
#lock {
background-color: #6991AC;
}
#headset {
background-color: #C3D7DF;
}
#truck {
background-color: #6991AC;
}
.one-fourth i { /*--Icons at one fourth blocks--*/
color: #F0F0F0;
font-size: 410%;
padding: 13% 0 4% 0;
}
article {
float: left;
margin: 0 auto;
width: 50%;
height: auto;
}
#sec-1 {
background-color: #FFFFFF;
}
aside {
float: right;
margin: 0 auto;
width: 50%;
height: auto;
}
.one-third {
width: 33.3333333%;
float: left;
text-align: center;
color: #FFFFFF
}
#google{
background-color: #A2B1C1;
}
#marketing {
background-color: #BEB9AD;
}
#customers {
background-color: #AADCD2;
}
/*--Start Footer--*/
footer {
background-color: #4682B4;
width: 100%;
}
.social {
list-style-type: none;
text-align: center;
}
.social li {
display: inline;
}
.social i { /*--icons--*/
font-size: 220%;
padding: 3% 3% 3% 2%;
color: #C3D7DF;
}
.social i:hover {
color: F5F5F5;
}
footer.second { /*--Socket--*/
border-top: 1px solid #AADCD2;
background-color: #544B59;
max-height: 55px;
text-align: center;
margin: 0;
}
footer.second p {
padding: 5px 0 9px 0;
text-align: center;
}
.carouselbox {
font-family: helvetica,sans-serif;
font-size: 14px;
width: 100px;
position: relative;
margin: 1em;
border: 1px solid #ccc;
box-shadow: 2px 2px 10px #ccc;
overflow: hidden;
}
.content {
margin: 0;
padding: 0;
}
.content li {
font-size: 100px;
margin: 0;
padding: 0;
width: 100%;
list-style: none;
text-align: center;
}
.new-inner {
height: 800px;
width: 100%;
float: left;
background-color: #FFFAFA;
font-family: Arial;
}
.nip1 {
width: 40%;
}
/*---------Insert Slideshow stuff below------*/
.cycle-slideshow{
width: 100%;
display: block;
position: relative;
margin: 0 auto;
overflow: hidden;
}
.cycle-prev, .cycle-next {
font-size: 200%;
color: #FFF;
top: 50%;
display: block;
position: absolute;
z-index: 9999;
cursor: pointer;
}
.cycle-prev {left: 10%;}
.cycle-next {right: 10%}
.cycle-pager{
width: 100%;
text-align: center;
display: block;
position: absolute;
bottom: 20px;
z-index: 9999;
cursor: pointer;
}
.cycle-pager span {
text-indent: 100%;
white-space: normal;
width: 12px;
height: 12px;
display: inline-block;
border: 1px solid #FFF;
border-radius: 50%;
margin: 0 10px;
}
.cycle-pager .cycle-pager-active {background: #FFF;}
/*------------MEDIA QUERIES ARE NOW STARTING-------------*/
#media screen and (max-width: 768px){
p {
font-size: 250%;
}
h3{
font-size: 260%;
}
header{
width: 100%;
}
#logo {
margin: 15px 0 20 -25px;
background: url(img/RD_mobile.png) no-repeat center;
float: left;
width: 170px;
height: 60px;
}
#menu-icon {
display: inline-block;
}
nav ul, nav:active ul {
display: none;
z-index: 1000;
position: absolute;
padding: 20px;
background: #6991AC;
right: 20px;
top: 60px;
border: 1px solid #FFF;
border-radius: 2px 0 2px 2px;
width: 50%;
}
nav:hover ul {
display: block;
}
nav li {
text-align: center;
width: 100%;
padding: 10px 0;
}
.one-fourth {
float: left;
width: 100%;
font-size: 30%;
}
.one-fourth i {
font-size: 500%;
padding: 4% 0 1% 0;
}
article {
width: 100%;
}
aside {
width: 100%;
}
.hand-mobile {
display: none;
}
.social i {
font-size: 100%;
}
}
Maybe try to change the media queries nav to position: relative;
EDIT:
Try this instead, change the display: none to inline:
nav ul, nav:active ul {
display: inline;
z-index: 1000;
position: relative;
padding: 20px;
background: #6991AC;
right: 20px;
top: 60px;
border: 1px solid #FFF;
border-radius: 2px 0 2px 2px;
width: 50%;
}

HTML position sidebar next to content

i am currently trying to move my sidebar from below the content box to the right of it alongside it. No matter what i try it stays at a certain point no going up any higher. My website is VAGUE LINES, where if you scroll down a bit u will be able to see exactly what i am saying.
Below is my css code thanks alot:
h1
{
text-align:center;
font-family:sans-serif;
letter-spacing:12px;
padding-bottom:6px;
border-top:1px solid rgb;
margin-top:35px;
color:#544E4F;
font-weight:lighter;
}
hr
{
display:overline-block;
width:200px;
}
#header
{
background: #FFFFFF;
text-align: center;
}
#navigation ul
{
margin: 0;
padding: 0;
list-style-type: none;
text-align: center;
}
#navigation ul li
{
display: inline;
padding-right: 30px;
}
#navigation ul li a
{
text-decoration: none;
padding: .3em 5em;
color: #000000;
background-color: #FFFFFF;
font-family: courier;
}
#navigation ul li a:hover
{
text-decoration: line-through;
}
.centeredImage
{
float: none;
margin: 4% 0 2% 9%;
text-align: center;
padding-bottom: 25px;
}
#main-content hr
{
width :66%;
margin-left: 9%;
}
#main-content
{
width:80%;
padding-left: 113px;
padding-top: 20px;
}
#page-wrap {
background: white;
min-width: 780px;
max-width: 1260px;
margin: 10px auto;
}
#page-wrap #inside {
margin: 10px 10px 0px 10px;
padding-top: 10px;
padding-bottom: 10px;
}
#sidebar{
border-top: 1px solid #99CC33;
border-left: 1px solid #99CC33;
height: 300px;
width: 200px;
margin-right: 5px;
padding: 5px 0 0 5px;
position:absolute;
}
#main-content p
{
margin-left: 10%;
font-family: courier;
font-size: 14px;
}
#heading p
{
margin-left: 10%;
font-family: sans-serif;
font-size: 14px;
}
#sidebar p
{
margin-left: 10%;
font-family: courier;
font-size: 14px;
font-weight:bold;
}
Try this:
#main-content
{
float: left; // float element to the left side
width:80%;
padding-left: 113px;
padding-top: 20px;
}
#sidebar{
border-top: 1px solid #99CC33;
border-left: 1px solid #99CC33;
height: 300px;
width: 200px;
margin-right: 5px;
padding: 5px 0 0 5px;
position:absolute;
right: 0; // position element to the right
}
EDIT: Sorry. You wanted sidebar on the right.

List style menu is not displaying in line

Here you can see the code: http://jsfiddle.net/LQSK3/1/
I can't get display: inline; working there for every li element.
Also got the problem width the line.png image, as it's height is the same as the font height, I want it to has 35px height with margin left and right set to 5px.
Where is the problem?
You need to update your style sheet. Please add this new style:
#menu {
position: relative;
clear: both;
top: -3px;
background-color: coral;
border: 1px solid black;
width: 800px;
height: 35px;
float:left;
}
li { display: inline;float:left; }
#menu ul {
position: absolute;
font-family: Century Gothic, sans-serif;
font-size: 14px;
list-style-type: none;
padding: 0;
margin: 9px 0 0 123px;
width: 649px;
height: 39px;
color: #FFF;
float:left;
}
a { font-weight: bold; color: red; text-decoration: none; }
a:hover { text-decoration: underline; }
#menu a {
background: url('http://i.imgur.com/rzNj0.png') top right no-repeat;
width: 65px;
height: 18px;
float: left;
margin: 0px 5px;
}
You need to add float: left; to menu div,ul,li and a . Also should set width and height and margin of the a tag.
Here is a working sample : http://jsfiddle.net/YjeBs/
Hope this helps :)
EDIT:
If you want your line to extend from top to bottom of the menu div you can change your styles to:
#menu {
position: relative;
clear: both;
top: -3px;
background-color: coral;
border: 1px solid black;
width: 800px;
height: 35px;
float:left;
}
li {
float: left;
height: 35px;
display:inline;
}
#menu ul {
color: #FFFFFF;
float: left;
font-family: Century Gothic,sans-serif;
font-size: 14px;
height: 35px;
list-style-type: none;
margin: 0 0 0 123px;
padding: 0;
position: absolute;
width: 649px;
}
a { font-weight: bold; color: red; text-decoration: none; }
a:hover { text-decoration: underline; }
#menu a {
background: url("http://i.imgur.com/rzNj0.png") no-repeat scroll right top transparent;
float: left;
height: 29px;
margin: 0 5px;
padding-top: 8px;
width: 65px;
}
Hope this is you want :)
just change li { diplay: inline; } with li { display: inline; } it works.

HTML - hovering doesn't work in Safari after embeded video is started. Works in FIrefox

I am reworking my website and hit two issues that I would like help with if possible.
The link to the test site is http://elovideo.com/test/index.html
1) I am adding embeded video with a poster so that it doesn't download when the page loads. When I view the page in Firefox and click on the movie, the hover still works on my other hyperlinks. My links light up, an underline appears or the hand is visible all indicating that those items can be selected.
However in Safari, once the video is selected my hover doesn't work. I am still able to click on the links, but for someone new to my site they wouldn't realize that some of the text is a hyperlink. The hover works fine prior to selecting the video for view/loading.
2) A dotted box appears around my video viewer when the movie is played in Firefox. I would like to be able to stop that from occurring. It doesn't happen in Safari.
I am quite certain the fault lies in user error as I am not highly skilled in writing code. Any help would be greatly appreciated. If I am doing something wrong, please let me know.
Thanks!
Erica
Style sheet CSS Code BELOW - HTML can be viewed on website source listed above.
html, body , ul, li {
margin: 0;
padding: 0;
list-style: none;
}
img {
border: 0;
}
a {
font-weight: bold;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.more {
text-align: right;
}
.left {
float: left;
}
.clear {
clear: both;
}
body, h1, h2, h3, form {
font: 14px tahoma, arial, sans-serif;
margin: 0;
padding: 0;
color: #7a895d; repeat-x;
}
body {
background: #7a895d url(images/headerback.jpg) repeat-x;
text-align: left;
}
#bodyinner {
background: url(images/white.jpg) repeat-y;
width: 960px;
margin: 0;
padding: 10px 30px 20px 10px;
z-index: 2;
}
#wrapper {
text-align: left;
margin: auto;
width: 1000px;
background: #7a895d ;
}
#header {
height: 100px;
position: absolute;
}
#header h1 {
margin-top: 0px;
}
#header h1 img {
display: block;
}
#bnav {
margin-top: 0px;
margin-left: 200px;
}
#bnav img {
float: left;
}
#nav {
margin-top: -80px;
margin-left: 200px;
}
#nav img {
float: left;
}
#headline {
padding: 210px 0px 0px 10px;
}
#photo {
float: left;
width: 624px;
}
#photo div {
border: 1px solid #a5b87c;
padding: 2px;
}
#photo img {
display: block;
}
#search-news {
float: right;
width: 240px;
}
#search-news div {
padding: 0px 0px 0px 0px;
}
#search-news #q {
width: 240px;
border: 1px solid #859D31;
margin: 1em 0 0 1em;
}
#search-news .downcast {
background: #E6E7E7;
border-top: 1px solid #CFD0D0;
padding: 0px 3px 3px 3px;
margin: 0.2em 0 0.4em 1em;
}
#search-news h3 {
background: url(images/bullet_letter.gif) no-repeat;
padding-left: 15px;
font-weight: bold;
margin: 1em 0 0.4em 1em;
}
#search-news p {
padding-left: 15px;
padding-right: 2px;
margin: 1em 0 0.4em 1em;
background: #7a895d repeat-x;
}
a {
font-weight: bold;
color: #5C5C5C;
}
#body-left {
float: left;
margin: 20px;
width: 408px;
}
#body-right {
float: right;
margin: 20px;
width: 450px;
}
#body-full {
float: left;
width: 1000px;
}
#body-left ul.plussbullets {
margin-top: 245px;
margin-left: 120px;
padding: 0;
font-weight: bold;
position: relative;
}
#body-left ul.plussbullets li {
background: top left url(images/bullet_plus.gif) repeat-x;
margin: 0 0 10px 0;
padding: 0 0 0 25px;
position: relative;
}
#body h2, #body p {
margin: 0.3em 0;
}
#body-right p {
margin-right: 2em;
}
#body a.green {
color: #9AAB68;
font-weight: normal;
text-decoration: underline;
}
#gallery img {
float: left;
padding: 0 0 5px 5px;
}
#footer {
color: #FFFFFF;
background: #42453D url(images/footer_bg.gif) repeat-x;
padding: 10px 10px 10px 10px;
font-weight: bold;
}
#footer p {
margin: 0;
text-align: center;
padding: 0px;
}
I don't quite understand what is being referenced in your first question. I don't see a hover working in either browser type.
In regards to removing the dotted outline, you want to use the following CSS for your object:
outline: none;