I'm new to html and css and in my class my teach wants us to make a resume with bootstrap. Obviously the whole point of bootstrap is to be interactive in switching between devices. Im trying to work on aligning stuff and i want my navbar to disappear when I shrink the page. How could I do that?
HTML
<!-- Bootstrap Import -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<!-- Meta Tags -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Titile and Style -->
<title>CadenGS's Resume</title>
<link href="https://fonts.googleapis.com/css2?family=Saira+Extra+Condensed:wght#700&display=swap" rel="stylesheet">
<script src="script.js"></script>
<link rel="stylesheet" href="style.css" type="text/css">
<!-- Navbar on Side -->
<nav class="navbar navbar-expand-lg col-lg-2 flex-direction-column justify-content-center">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown"
aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Navbar List Items -->
<img id="pfp" src="Images/user_photo.jpg">
<br>
<ul class="navbar-nav f-flex flex-column">
<li class="nav-item active">
<a class="nav-link" href="#top">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#exp">Experience</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Education</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Skills</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Awards</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Examples</a>
</li>
</ul>
</nav>
<section>
<!-- Used To Scroll To Top of Page for Picture and About on Navbar -->
<p id="top">.</p>
<!-- Content Start -->
<div id="main" class="container margin-top-10%">
<h1 id="primaryName" class="display-2">Caden <span id="secondaryName">Serrato</span></h1>
<!-- Interactive Contacts -->
<p class="info" class="display-4"><em>
<a class="infoLink" onclick="call();">(786) 442-6148</a> ยท <a class="infoLink"
href="emailFiles/email.html" target="_blank">#cserrato21352#columbushs.com</a></em></p>
<br>
<p class="info2 display-4"><strong><em>I am a Senior High School Student looking to go into the Field of
Engineeing. My
goal is to dual major in Mechanical</em></strong></p>
<p class="info2 display-4" style="text-indent: 80px; margin-top: -10px;"><strong><em>and Engineering, and
hopefully one day work at
Boston Dynamics.</em></strong></p>
<!-- Socials -->
<div id="socials" class="d-flex flex-direction-row" style="margin-top: 7%;">
<!-- Github -->
<div class="socialHolder">
<a href="https://github.com/CadenCGS" target="_about">
<div class="socialLinks">
<img id="gitSocialImg" src="Images/gitSocial.jpg">
</div>
</a>
</div>
<!-- Instagram -->
<div class="socialHolder">
<a href="https://www.instagram.com/cadenserrato/" target="_about">
<div class="socialLinks">
<img id="igSocialImg" src="Images/igSocial.png">
</div>
</a>
</div>
<!-- Facebook -->
<div class="socialHolder">
<a href="https://www.facebook.com/ColumbusHS/" target="_about">
<div class="socialLinks">
<img id="fbSocialImg" src="Images/fbSocial.png">
</div>
</a>
</div>
<!-- LinkedIn -->
<div class="socialHolder">
<a href="https://www.linkedin.com" target="_about">
<div class="socialLinks">
<img id="liSocialImg" src="Images/liSocial.png">
</div>
</a>
</div>
</div>
</div>
<!-- Used To Scroll To Experience on Navbar -->
<p id="exp">.</p>
<hr class="pageBreak">
<!-- Experience Section -->
<div id="experience" class="container">
<h1 style="margin-top: 8%; text-indent: 35px; color: rgba(63, 158, 253, .9);"
class="subSectionName display-3">
Experience</h1>
<h1 style="text-indent: 60px; font-size: 3rem; margin-top: 2%;" class="subSectionName display-4">Robotics
</h1>
<br>
<p class="info2 display-4" style="text-indent: 120px;"><strong><em>I started my first year as a simple
builder
as
I
learned the basics of Vex. My second year I was a bit more</em></strong></p>
<p class="info2 display-4" style="text-indent: 60px; margin-top: -10px;"><strong><em> experienced and began
to
build
for advanced and
complicated
mechanisms. I built all year and ended up finishing </em></strong></p>
<p class="info2 display-4" style="text-indent: 80px; margin-top: -10px;"><strong><em>in 8th place at the
state
championship my team qualified for.</em></strong></p>
<div class="container">
<hr id="aboveDate">
<p class="info2 display-4" style="text-indent: 100px; margin-top: 2%;"><strong>Date: <span
style="color: rgba(63, 158, 253, 1);">August 2018 -
Present</span></strong></p>
</div>
</div>
</section>
<!-- Bootstrap Scripts -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/popper.js#1.16.1/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous">
</script>
CSS
height: 4000px;
background-color: rgb(248, 248, 239);
}
html {
background-color: rgb(248, 248, 239);
scroll-behavior: smooth;
}
.navbar {
background-color: rgba(63, 158, 253, .9);
height: 100%;
position: fixed;
text-align: center;
flex-direction: column;
border-right: 9px solid rgb(168, 211, 255);
}
ul {
display: flex;
justify-content: center;
}
.nav-link {
transition: all .25s;
color: rgba(255, 255, 255, 0.726);
font-size: 1.5rem;
}
.nav-link:hover {
transition: all .25s;
color: white;
text-shadow: darkslategrey;
font-size: 1.7rem;
}
#pfp {
border: 9px solid rgba(255, 255, 255, .4);
border-radius: 50%;
height: 160px;
width: 160px;
position: static;
margin-bottom: 20px;
}
#primaryName {
font-family: 'Saira Extra Condensed';
color: rgb(146, 146, 146);
font-size: 6rem;
}
#secondaryName {
font-family: 'Saira Extra Condensed';
color: rgba(63, 158, 253, .9);
font-size: 6rem;
}
#main {
padding-top: 10%;
margin-left: 7%;
}
.info {
font-size: 1.7rem;
}
.info2 {
font-size: 1.3rem;
text-indent: 30px;
}
#top,
#exp {
color: rgba(63, 158, 253, 0);
}
.infoLink {
text-decoration: none;
font-family: 'Saira Extra Condensed';
color: rgb(110, 110, 110);
}
.infoLink:hover {
color: black;
}
#emailLink {
text-decoration: none;
color: black;
}
.socialHolder {
margin-left: 3%;
}
.socialLinks {
height: 65px;
width: 65px;
border-radius: 50%;
background-color: rgb(146, 146, 146);
display: flex;
justify-content: center;
transition: all .25s;
}
.socialLinks:hover {
transition: all .25s;
background-color: rgb(75, 75, 75);
}
#gitSocialImg {
border-radius: 50%;
height: 55%;
width: 55%;
margin-top: 25%;
}
#igSocialImg {
border-radius: 50%;
height: 80%;
width: 80%;
margin-top: 11%;
}
#fbSocialImg {
border-radius: 50%;
height: 55%;
width: 55%;
margin-top: 22%;
}
#liSocialImg {
border-radius: 50%;
height: 55%;
width: 55%;
margin-top: 22%;
}
.pageBreak {
border: 2px solid rgba(63, 158, 253, .9);
width: 85%;
margin-top: 4%;
margin-right: 13%;
}
.subSectionName {
font-family: 'Saira Extra Condensed';
color: rgb(146, 146, 146);
}
.subSectionInfo {
font-family: 'Saira Extra Condensed';
color: rgb(110, 110, 110);
font-size: 1.7rem;
margin-left: 60px;
}
#experience {
margin-left: 4.6%;
}
#aboveDate {
border: 2px solid rgba(63, 158, 253, .9);
width: 27.5%;
margin-left: 6%;
margin-bottom: -1%;
}```
You can write a media query and than do display: none; on the element you want to disappear.
Example:
#media (max-width: 800px) {
.navbar {
display: none;
}
}
Related
I created a card which i would like it to translate along the y-axis and throw a shadow upon hover. The translation along the y-axis is working well but the shadow doesn't get thrown when i hover over the card. I wrote the following css rule and i don't know if i got it right, because it clearly is NOT working on everything i applied it on:
:root {
--brand: #b33030;
--body: #606060;
--dark: #19282f;
--border-radius: 4px;
--shadow: 0px 4px 60px rgba(0, 0, 0, 0.14);
}
/* reset & helpers */
body {
font-family: "Source Sans Pro", sans-serif;
line-height: 1.7;
color: var(--body);
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 700;
color: var(--dark);
font-family: "Domine", sans-serif;
}
a {
color: var(--dark);
text-decoration: none;
transition: all 0.4s linear;
}
a:hover {
color: var(--brand);
}
a.custom-link {
text-transform: uppercase;
font-weight: 700;
font-size: 14px;
}
img {
width: 100%;
}
section {
padding-top: 100px;
padding-bottom: 100px;
}
.section-intro {
margin-bottom: 33px;
text-align: center;
}
.section-intro p {
margin: auto;
max-width: 500px;
}
.custom-card {
transition: all 0.4s ease;
background-color: white;
border-radius: var(--border-radius);
}
.custom-card:hover {
box-shadow: var(--shadow);
transform: translateY(-5px);
}
/* Hero */
#hero {
min-height: 100vh;
background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url(../../../assets/images/hero_bg_img.jpg);
background-size: cover;
background-position: center;
text-align: center;
display: flex;
align-items: center;
background-attachment: fixed;
}
#hero h1 {
font-weight: 700;
}
#hero h1,
#hero p {
color: white;
}
#hero p {
max-width: 500px;
margin: 12px auto 24px auto;
}
#hero button {
padding: 12px 28px;
background-color: rgba(255, 255, 255, 0.3);
border: none;
color: white;
width: 40%;
}
#hero button:focus {
box-shadow: 1px;
}
/* button */
.btn {
padding: 12px 28px;
font-size: 16px;
text-transform: uppercase;
border-radius: var(--border-radius);
font-weight: 700;
border-radius: var(--border-radius);
transition: all 0.4s ease;
}
.btn:hover {
transform: translateY(-3px);
}
.btn-brand {
background-color: var(--brand);
color: white;
}
.btn-brand:hover {
color: white;
}
/* Navbar */
.navbar.bg-white {
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.navbar .navbar-nav .nav-link {
font-size: 14px;
font-weight: 700;
text-transform: uppercase;
}
.navbar .navbar-nav .nav-link:hover .navbar .navbar-nav .nav-link.active {
color: var(--brand);
}
/* Features */
.features {
padding: 44px 24px;
text-align: center;
}
.icon-box {
width: 80px;
height: 80px;
background-color: var(--brand);
color: white;
border-radius: var(--border-radius);
font-size: 34px;
display: flex;
align-items: center;
justify-content: center;
margin: auto;
}
.features h5 {
margin-top: 28px;
margin-bottom: 12px;
}
.features p {
font-size: 14px;
}
<!-- NAV -->
<nav class="navbar navbar-expand-lg navbar-light bg-white sticky-top">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#testimonials">Testimonials</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#login">Login</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- END OF NAV-->
<!-- HERO -->
<section id="hero">
<div class="container">
<div class="row">
<div class="col-12">
<h1 class="display-3">Brighter Brain</h1>
<p>
Creating a pathway to make access to education easier, flexible and profound.
</p>
</div>
</div>
<div class="row">
<p>
<button class="btn btn-brand" type="button" id="button">
Get started.
</button>
</p>
</div>
</div>
</section>
<!-- END OF HERO-->
<!-- FEATURES -->
<section id="features">
<div class="container">
<div class="row">
<div class="col-12 section-intro">
<h1>Our Features</h1>
<p>
We have a very significant number of features which will help make educational life easily.
</p>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-md-6">
<div class="features custom-card">
<div class="icon-box">
<i class="ri-live-fill"></i>
</div>
<h5>Features Title</h5>
<p>
Integrated administrative design and monitoring of teaching manuals, digital class and examinations deployable anywhere and anytime.
</p>
Read more
</div>
</div>
</div>
</div>
</section>
<!-- END OF FEATURES -->
The root rule in the CSS is suppose to handle all color applications, hovers et al BUT it is not working. Am i doing this right?
Thanks in advance.
I just threw your code into a runnable snippet and the shadow on hover seems to be working for me.
I darkened it to 0.5 opacity so it's more obvious.
:root {
--brand: #b33030;
--body: #606060;
--dark: #19282f;
--border-radius: 4px;
--shadow: 0px 4px 60px rgba(0, 0, 0, 0.5);
}
/* reset & helpers */
body {
font-family: "Source Sans Pro", sans-serif;
line-height: 1.7;
color: var(--body);
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 700;
color: var(--dark);
font-family: "Domine", sans-serif;
}
a {
color: var(--dark);
text-decoration: none;
transition: all 0.4s linear;
}
a:hover {
color: var(--brand);
}
a.custom-link {
text-transform: uppercase;
font-weight: 700;
font-size: 14px;
}
img {
width: 100%;
}
section {
padding-top: 100px;
padding-bottom: 100px;
}
.section-intro {
margin-bottom: 33px;
text-align: center;
}
.section-intro p {
margin: auto;
max-width: 500px;
}
.custom-card {
transition: all 0.4s ease;
background-color: white;
border-radius: var(--border-radius);
}
.custom-card:hover {
box-shadow: var(--shadow);
transform: translateY(-5px);
}
/* Hero */
#hero {
min-height: 100vh;
background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
url(../../../assets/images/hero_bg_img.jpg);
background-size: cover;
background-position: center;
text-align: center;
display: flex;
align-items: center;
background-attachment: fixed;
}
#hero h1 {
font-weight: 700;
}
#hero h1,
#hero p {
color: white;
}
#hero p {
max-width: 500px;
margin: 12px auto 24px auto;
}
#hero button {
padding: 12px 28px;
background-color: rgba(255, 255, 255, 0.3);
border: none;
color: white;
width: 40%;
}
#hero button:focus {
box-shadow: 1px;
}
/* button */
.btn {
padding: 12px 28px;
font-size: 16px;
text-transform: uppercase;
border-radius: var(--border-radius);
font-weight: 700;
border-radius: var(--border-radius);
transition: all 0.4s ease;
}
.btn:hover {
transform: translateY(-3px);
}
.btn-brand {
background-color: var(--brand);
color: white;
}
.btn-brand:hover {
color: white;
}
/* Navbar */
.navbar.bg-white {
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.navbar .navbar-nav .nav-link {
font-size: 14px;
font-weight: 700;
text-transform: uppercase;
}
.navbar .navbar-nav .nav-link:hover .navbar .navbar-nav .nav-link.active {
color: var(--brand);
}
/* Features */
.features {
padding: 44px 24px;
text-align: center;
}
.icon-box {
width: 80px;
height: 80px;
background-color: var(--brand);
color: white;
border-radius: var(--border-radius);
font-size: 34px;
display: flex;
align-items: center;
justify-content: center;
margin: auto;
}
.features h5 {
margin-top: 28px;
margin-bottom: 12px;
}
.features p {
font-size: 14px;
}
<!-- NAV -->
<nav class="navbar navbar-expand-lg navbar-light bg-white sticky-top">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#about">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#testimonials">Testimonials</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#contact">Contact Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#login">Login</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- END OF NAV-->
<!-- HERO -->
<section id="hero">
<div class="container">
<div class="row">
<div class="col-12">
<h1 class="display-3">Brighter Brain</h1>
<p>
Creating a pathway to make access to education easier, flexible and
profound.
</p>
</div>
</div>
<div class="row">
<p>
<button class="btn btn-brand" type="button" id="button">
Get started.
</button>
</p>
</div>
</div>
</section>
<!-- END OF HERO-->
<!-- FEATURES -->
<section id="features">
<div class="container">
<div class="row">
<div class="col-12 section-intro">
<h1>Our Features</h1>
<p>
We have a very significant number of features which will help make
educational life easily.
</p>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-md-6">
<div class="features custom-card">
<div class="icon-box">
<i class="ri-live-fill"></i>
</div>
<h5>Features Title</h5>
<p>
Integrated administrative design and monitoring of teaching manuals,
digital class and examinations deployable anywhere and anytime.
</p>
Read more
</div>
</div>
</div>
</div>
</section>
<!-- END OF FEATURES -->
*{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
::selection{
background-color: #333;
color: rgb(255, 230, 0);
}
::-moz-selection{
background-color: #333;
color: rgb(255, 255, 255);
}
::-webkit-scrollbar{
width: 10px;
}
::-webkit-scrollbar-thumb{
background-color: rgb(255, 198, 198);
-webkit-border-radius: 10px;
}
::-webkit-scrollbar-track{
background-color: #f8f8f8;
}
header{
width: 100%;
z-index: 100;
}
.nav-list, #left-navbar, #right-navbar{
display: flex;
}
.img-logo{
width: 200px;
transform: translateX(-20px);
}
#right-navbar{
transform: translateX(300px);
}
.nav-list{
position: fixed;
width: 1152px;
top: 0;
left: 110px;
background-color: rgb(255, 255, 255);
list-style-type: none;
padding: 20px;
box-shadow: 0px 0px 9.5px 0px black;
}
.n{
text-decoration: none;
color: black;
font-size: 14px;
font-weight: 700;
}
.nav-link{
text-decoration: none;
padding: 10px;
color: black;
font-size: 14px;
font-weight: 700;
}
.nav-link:hover{
border-bottom: 4px solid rgb(255, 0, 0);
transition: all ease-out .5s;
}
.n:hover{
border-bottom: 4px solid rgb(255, 0, 0);
transition: all ease-out .5s;
}
#free-web-hosting{
background-color: #f8f8f8;
height: 100vh;
padding: 230px 100px;
overflow-y: hidden;
background-image: url(https://images2.imgbox.com/d7/c9/XyznzmUz_o.png);
background-repeat: no-repeat;
background-position-x: 600px;
background-position-y: 170px;
}
button{
background-color: #ff5d64;
border-radius: 5px;
box-shadow: .5px .5px 20px .5px rgb(212, 209, 209);
border: none;
padding: 12px;
}
.fwh-img{
transform: translate(470px, -250px);
z-index: 1;
}
.fas, .nav-link{
position: relative;
top: 19px;
}
.bg-red{
border: none;
border-radius: 5px;
background-color: red;
color: white;
margin: 0px 40px;
padding: 10px 25px;
box-shadow: 0px 0px 10px 0px rgb(255, 140, 140);
}
#sponsors{
display: flex;
justify-content: center;
align-items: center;
}
.sponsors-img{
padding: 10px 40px;
margin-top: 30px;
}
#all-starts{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: 60px 0px;
}
#pricing-container{
display: flex;
justify-content: center;
align-items: center;
}
.pricing{
width: 280px;
height: 100vh;
box-shadow: 0px 0xp 10px 0px;
border: 1px solid black;
}`enter code here`
.pricing1, .see-more{
display: flex;
flex-direction: column;
}
#media (max-width: 768px) {
#free-web-hosting{
background-image: none;
text-align: center;
line-break: loose;
}
#sponsors{
display: flex;
flex-wrap: wrap;
}
#pricing-container{
display: flex;
flex-wrap: wrap;
}
#all-starts{
text-align: center;
display: flex;
flex-wrap: wrap;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="shortcut icon" href="https://images2.imgbox.com/a5/2f/URZJk3ro_o.png" type="image/x-icon">
<script src="https://kit.fontawesome.com/fa9f85711d.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="000web.css">
<title>Free Web Hosting - Host a Website for Free with Cpanel, PHP</title>
</head>
<body>
<header>
<nav id="nav-bar">
<ul class="nav-list">
<div id="left-navbar">
<img class="img-logo" src="https://svgshare.com/i/YPv.svg" alt="logo">
<li><a class="n" href="#"><span class="nn" style="color: rgb(255, 20, 20); font-size: 14px; font-weight: 900; border: none;">SALE</span><br>Cheap Web Hosting</a></li>
<li><a class="nav-link" href="#">Website Builder</a></li>
<li><a class="nav-link" href="#">Forum</a></li>
</div>
<div id="right-navbar">
<span class="fas fa-globe"></span>
<li><a style="color: rgb(255, 25, 25); border: none;" class="nav-link" href="#">SIGN IN</a></li>
<li><a class="nav-link bg-red" href="#">GO PREMIUM</a></li>
</div>
</ul>
</nav>
</header>
<main>
<div id="free-web-hosting">
<div id="con">
<h3 class="h33" style="font-size: 45px; color: #2b464c; font-weight: 700;">Free Web Hosting</h3>
<p style="margin: 30px 0px; line-height: 25px;"><span style="color: rgb(253, 67, 67);">Zero</span> cost website hosting with PHP,<br> MySQL, cPanel & no ads!</p>
<button style="color: rgb(255, 255, 255);">GET STARTED</button><br>
</div>
</div>
<div id="sponsors">
<img class="sponsors-img" src="https://svgshare.com/i/YQe.svg" alt="php logo">
<img class="sponsors-img" src="https://svgshare.com/i/YQp.svg" alt="cloudflare logo">
<img class="sponsors-img" src="https://svgshare.com/i/YR0.svg" alt="nginx logo">
<img class="sponsors-img" src="https://svgshare.com/i/YNt.svg" alt="cloudlinux logo">
<img class="sponsors-img" src="https://svgshare.com/i/YNu.svg" alt="intel logo">
<img class="sponsors-img" src="https://svgshare.com/i/YR1.svg" alt="wordpress logo">
<img class="sponsors-img" src="https://svgshare.com/i/YNM.svg" alt="mysql logo">
</div>
<div id="all-starts">
<h1>It All Starts Here</h1>
<p>Choose one of the premium plans and enjoy all the greatest features, industry leading performance and top of<br>the class 24/7 live support on the market. Unlimited hardware resources, free domain, SSL & SSH also included!</p>
</div>
<div id="pricing-container">
<div class="pricing pricing1">
<h4>$000/mo</h4>
<li class="fas fa-check">1 Website</li>
<li class="fas fa-check">300 MB Disk Space</li>
<li class="fas fa-check">Limited Bandwidth (3 GB)</li>
<li class="fas fas fa-times">No Email Account</li>
<li class="fas fas fa-times">24/7/365</li><br>
<div class="see-more">
<span>See all features</span>
<li>FREE SIGN UP</li>
</div>
</div>
<div class="pricing"></div>
<div class="pricing"></div>
<div class="pricing"></div>
</div>
</main>
</body>
</html>
I completed responsive web design last 3 weeks on freecodecamp, and I have been building pages looking at other websites to improve my portfolio, but this web page I'm building is very difficult, can you please into the code and tell me where I went wrong. I thought that I was overusing the <li> that is why it is behaving this wa
y.
See here
enter image description here
Wrap Your list elements in a ul tag and give it a negative z-index styling
<ul style="z-index: -1000 !important;">
<li class="fas fa-check">1 Website</li>
<li class="fas fa-check">300 MB Disk Space</li>
<li class="fas fa-check">Limited Bandwidth (3 GB)</li>
<li class="fas fas fa-times">No Email Account</li>
<li class="fas fas fa-times">24/7/365</li>
</ul><br />
This Works
PRO TIP:
Always make sure to put your <li> </li> elements in an immediate container for better and easy styling
You could do something like
<ul><li></li></ul>
If you use position fixed the next element will be positioned at the previous element's position. if you want your navbar to be fixed you have to do something like this:
<div class="relative">
<div class="navbar fixed">
</div>
</div>
<div class="relative">
</div>
Hello i have just started to learn to code today and i decided to start with html and css.
I'm making and website template / layout using html css and bootstrap 4.
But i have run into a problem with my divs being wider than my header and navigation bar when not responsive and can't seem to work out why and was hoping maybe someone could tell me why.
Image of my divs being wider
I'm also trying to float / angle two of the last links in the navigation bar to the right but they don't.
* {
box-sizing: border-box;
}
html {
height: 100%;
font-family: "Hammersmith One", Hammersmith One, sans-serif;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: "Hammersmith One", Hammersmith One, sans-serif;
}
body {
margin: 1em 10em;
font-size: 0.8750em;
color: rgb(255, 255, 255);
background-color: rgb(255, 255, 222);
}
header {
margin-bottom: 1em;
background-color: rgb(0, 0, 0, 0.4);
border-radius: 5px;
border: 2px solid rgb(0, 0, 0);
}
nav {
margin-bottom: 1em;
overflow: hidden;
color: rgb(255, 255, 255);
background-color: rgb(0, 0, 0, 0.4);
border-radius: 5px;
border: 2px solid rgb(0, 0, 0);
}
nav a {
float: left;
display: block;
color: rgb(242, 242, 242);
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-weight: bold;
}
nav a:hover {
background-color: rgb(71, 149, 13);
color: rgb(242, 242, 242);
;
}
.card {
margin-bottom: 1em;
background-color: rgb(0, 0, 0, 0.4);
border-radius: 5px;
border: 2px solid rgb(0, 0, 0);
}
.leftcolumn {
float: left;
width: 75%;
}
.rightcolumn {
float: left;
width: 25%;
padding-left: 20px;
}
.row:after {
content: "";
display: table;
clear: both;
}
footer {
font-size: 16px;
color: rgb(255, 255, 255, 0.4);
text-shadow: 0 1px 3px rgb(0, 0, 0, 0.2);
}
#media screen and (max-width: 800px) {
.leftcolumn,
.rightcolumn {
width: 100%;
padding: 0;
}
}
<!DOCTYPE html>
<html>
<head>
<title>My website</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Hammersmith One" rel="stylesheet" />
</head>
<body>
<header class="container-fluid text-center">
<h1>My Header</h1>
<p>Text Here</p>
</header>
<nav class="navbar navbar-expand-sm" id="navbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Link 1</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link 2</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link 3</a>
</li>
<li class="nav-item" style="float:right">
<a class="nav-link" href="#">Link 4</a>
</li>
<li class="nav-item" style="float:right">
<a class="nav-link" href="#">Link 5</a>
</li>
</ul>
</nav>
<div class="row">
<div class="leftcolumn">
<div class="card">
<h5 class="card-header bg-dark text-center">Card Header</h5>
<div class="card-body text-center">Card Body Content</div>
</div>
</div>
<div class="rightcolumn">
<div class="card">
<h5 class="card-header bg-dark text-center">Card Header</h5>
<div class="card-body text-center">Card Body Content</div>
</div>
<div class="card">
<h5 class="card-header bg-dark text-center">Card Header</h5>
<div class="card-body text-center">Card Body Content</div>
</div>
<div class="card">
<h5 class="card-header bg-dark text-center">Card Header</h5>
<div class="card-body text-center">Card Body Content</div>
</div>
</div>
</div>
<footer class="container-fluid text-center fixed-bottom">
<p><b>Footer Text</b></p>
</footer>
</body>
</html>
I would like to align the two buttons on the middle line and also align the white balls on the line, I've tried using position with CSS but I didn't succeed, I'm not good at design, and I also don't know how to be responsive on all devices
Could someone please help me? I don't know what to do to adjust this
I don't think it is the best approach, but could be considered as an option
Try modifying the left value of the following:
.tabs_inner .tab-content .tab-pane .list:before {
left: 50.5% // was 46%
}
This would fix your issue until the screen size gets lower than 500px. You might have to change the left value again for the lower screen sizes.
Hope this helped!
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<style>
.mytabs_area {
background-image: -moz-linear-gradient(0deg, #766dff 0%, #88f3ff 100%);
background-image: -webkit-linear-gradient(0deg, #766dff 0%, #88f3ff 100%);
background-image: -ms-linear-gradient(0deg, #766dff 0%, #88f3ff 100%);
}
.p_120 {
padding-top: 120px;
padding-bottom: 120px;
}
#media (max-width: 575px) {
.p_120 {
padding-top: 70px;
padding-bottom: 70px;
}
}
.tabs_inner .nav.nav-tabs {
display: block;
text-align: center;
border: none;
margin-bottom: 120px;
}
.tabs_inner .nav.nav-tabs li {
display: inline-block;
margin-right: 8px;
}
.tabs_inner .nav.nav-tabs li a {
margin: 0px;
line-height: 50px;
border-radius: 5px;
padding: 0px 40px;
font-size: 13px;
font-weight: 500;
color: #fff;
font-family: "Roboto", sans-serif;
border: 1px solid #9ab5f5;
background: rgba(255, 255, 255, 0.1);
}
.tabs_inner .nav.nav-tabs li a.active {
background: #fff;
color: #222222;
}
.tabs_inner .tab-content .tab-pane .list {
max-width: 460px;
margin: auto;
position: relative;
padding-top: 40px;
padding-bottom: 60px;
}
.tabs_inner .tab-content .tab-pane .list:before {
content: "";
height: 100%;
width: 5px;
background: rgba(255, 255, 255, 0.2);
position: absolute;
left: 46%;
transform: translateX(-50%);
top: -5px;
}
.tabs_inner .tab-content .tab-pane .list li {
margin-bottom: 60px;
position: relative;
}
.tabs_inner .tab-content .tab-pane .list li span {
height: 15px;
width: 15px;
border-radius: 50%;
display: block;
background: rgba(255, 255, 255, 0.2);
position: relative;
left: 8.6rem;
top: 2.1rem;
transform: translateX(-50%);
}
.tabs_inner .tab-content .tab-pane .list li span:before {
content: '';
height: 7px;
width: 7px;
background: #fff;
border-radius: 50%;
position: absolute;
left: 52%;
top: 4px;
transform: translateX(-50%);
}
.tabs_inner .tab-content .tab-pane .list li:last-child {
margin-bottom: 0px;
}
.tabs_inner .tab-content .tab-pane .list li .media .d-flex {
padding-right: 100px;
}
.tabs_inner .tab-content .tab-pane .list li .media .d-flex p {
color: rgba(255, 255, 255, 0.75);
margin-bottom: 0px;
padding-top: 20px;
position: relative;
right: 2rem;
}
.tabs_inner .tab-content .tab-pane .list li .media .media-body h4 {
color: #fff;
font-size: 21px;
text-transform: uppercase;
margin-bottom: 20px;
}
.tabs_inner .tab-content .tab-pane .list li .media .media-body p {
color: rgba(255, 255, 255, 0.75);
margin-bottom: 0px;
}
.tabs_inner .tab-content .tab-pane .list li .media .media-body h4 {
color: #fff;
font-size: 21px;
text-transform: uppercase;
margin-bottom: 20px;
}
.tabs_inner .tab-content .tab-pane .list li .media .d-flex p {
color: rgba(255, 255, 255, 0.75);
margin-bottom: 0px;
padding-top: 20px;
}
</style>
<title>Hello, world!</title>
</head>
<body>
<h1>Hello, world!</h1>
<section class="mytabs_area p_120">
<div class="container">
<div class="tabs_inner">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab"
aria-controls="home" aria-selected="true">My Experiences</a>
</li>
<li class="nav-item">
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab"
aria-controls="profile" aria-selected="false">My Education</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
<ul class="list">
<li>
<span></span>
<div class="media">
<div class="d-flex">
<p>March 2017 to present</p>
</div>
<div class="media-body">
<h4>Colorlib</h4>
<p>Senior Web Developer <br />Santa monica, Los angeles</p>
</div>
</div>
</li>
<li>
<span></span>
<div class="media">
<div class="d-flex">
<p>March 2017 to present</p>
</div>
<div class="media-body">
<h4>Colorlib</h4>
<p>Senior Web Developer <br />Santa monica, Los angeles</p>
</div>
</div>
</li>
<li>
<span></span>
<div class="media">
<div class="d-flex">
<p>March 2017 to present</p>
</div>
<div class="media-body">
<h4>Colorlib</h4>
<p>Senior Web Developer <br />Santa monica, Los angeles</p>
</div>
</div>
</li>
</ul>
</div>
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
<ul class="list">
<li>
<span></span>
<div class="media">
<div class="d-flex">
<p>March 2017 to present</p>
</div>
<div class="media-body">
<h4>Colorlib</h4>
<p>Senior Web Developer <br />Santa monica, Los angeles</p>
</div>
</div>
</li>
<li>
<span></span>
<div class="media">
<div class="d-flex">
<p>March 2017 to present</p>
</div>
<div class="media-body">
<h4>Colorlib</h4>
<p>Senior Web Developer <br />Santa monica, Los angeles</p>
</div>
</div>
</li>
<li>
<span></span>
<div class="media">
<div class="d-flex">
<p>March 2017 to present</p>
</div>
<div class="media-body">
<h4>Colorlib</h4>
<p>Senior Web Developer <br />Santa monica, Los angeles</p>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous">
</script>
</body>
</html>
Code updated: Just swap with yours.
Explanation:
I have changed the position of the text and the white button to relative and replace it on aligned form.
What I am trying to do is make it so that the text can be shown over the image. I put the text in an h1 tag which is inside of a div inside of the body. However, for some reason the changes aren't registering. In-fact, any changes that I make to the text that I want to be in the center of the image, those changes aren't registering at all.
HTML:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<title>Home Page</title>
<script type="text/javascript">
<script src="script.js" charset="utf-8"></script>
</head>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<img src="https://cdn.discordapp.com/attachments/770076532433354783/770076695368564776/vice-logoFlag1.png" width="50" height="50">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" id="homeWording" href="/Users/nixon/Documents/Website Development/Website 1 Project/home.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Gang Database
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">The Ballas</a>
<a class="dropdown-item" href="#">The Families</a>
<a class="dropdown-item" href="#">Los Santos Vagos</a>
<a class="dropdown-item" href="#">Varrios Los Aztecas</a>
<a class="dropdown-item" href="#">Marabunta Grande</a>
</div>
</li>
</ul>
<button class="btn btn-outline-success my-2 my-sm-0" id="logout" type="submit">Log out</button>
</div>
</nav>
<body>
<div class="image">
<img src="https://cdn.discordapp.com/attachments/398526333480599563/720783925395456021/TC21.png" alt="" width="100%" height="350">
<h1>TEXT IN CENTER</h1>
</div>
</body>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
</html>
CSS:
body {
background-color: #212529;
}
.main {
background-color: #77857b;
width: 400px;
height: 400px;
margin: 7em auto;
border-radius: 1.5em;
box-shadow: 0px 11px 35px 2px rgba(0, 0, 0, 0.14);
}
#signInLettering {
font-size: 34px;
font-family: Optima;
padding-top: 40px;
font-weight: bold;
color: #d8e7eb;
font-style: italic;
}
.un {
width: 76%;
color: rgb(38, 50, 56);
font-weight: 700;
font-size: 14px;
letter-spacing: 1px;
background: #d8e7eb;
padding: 10px 20px;
border: none;
border-radius: 20px;
outline: none;
box-sizing: border-box;
border: 2px solid rgba(0, 0, 0, 0.02);
margin-bottom: 50px;
margin-left: 46px;
text-align: center;
margin-bottom: 27px;
font-family: 'Ubuntu', sans-serif;
}
.pass {
width: 76%;
color: rgb(38, 50, 56);
font-weight: 700;
font-size: 14px;
letter-spacing: 1px;
background: #d8e7eb;
padding: 10px 20px;
border: none;
border-radius: 20px;
outline: none;
box-sizing: border-box;
border: 2px solid rgba(0, 0, 0, 0.02);
margin-bottom: 50px;
margin-left: 46px;
text-align: center;
margin-bottom: 27px;
font-family: 'Ubuntu', sans-serif;
}
#homeWording {
padding-right: 50px;
}
.image {
position: relative;
width: 100%;
}
h1 {
position: absolute;
top: 200px;
left: 0;
width: 100%;
}
In your CSS:
.image {
position: relative;
width: 100%;
}
Possible Solution:
.image {
position: relative;
width: 100%;
text-align: center;
}
See here
Just use flexbox like this
Give a higher z-index to the H1 and change the positioning of the image to absolute.
See codepen https://codepen.io/thewhitegrizzzzli/pen/xxOqdGM
.image {
position: relative;
width: 100%;
display:flex;align-items:center;justify-content:center;
height:350px;
}
.image img {
position:absolute;top:0;
}
h1 {
z-index:10;
}