For my site I want to show some products on my site and when you hover over these products, there should be more information. Currently the design for the product card is there. I have 2 questions that I cannot get to work.
I cannot get the shadow box around the whole div when I hover around it. Have tried to add a height to my div but that messed up the layout of my other divs. What am I doing wrong?
Also the border of my div goes through my button (at least the link I have styled as a button). How can I fix this?
.home-products {
width: auto;
height: 250px;
}
.product-image-home {
height: 200px;
}
.product-grid {
position: relative;
float: left;
margin-left: 3px;
margin-right: 3px;
text-align: center;
width: 225px;
}
.product-grid h3 {
margin: 0;
text-align: center;
margin-bottom: 5px;
font-size: 20px "Open Sans", Helvetica, Arial, sans-serif;
}
.product-overlay-button {
background: #85bf31;
height: 550px;
border: none;
border-radius: 2px;
color: #fff;
font-weight: bold;
font-size: 14px;
padding: 0.6em 2em;
margin-top: 5px;
text-decoration: none;
text-align: center;
}
.product-grid:hover {}
.product-info {
display: none;
position: absolute;
width: 225px;
position: absolute;
text-align: center;
float: left;
margin-left: 3px;
margin-right: 3px;
}
.product-info p {
margin-left: 7px;
margin-right: 7px;
}
.product-grid:hover .product-info {
display: block;
}
.product-grid:hover {
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
<div class="home-products">
<div class="product-grid">
<img class="product-image-home" src="https://cardpile.nl/wp-content/uploads/2021/04/blood-rage-460x460.jpg" alt="Homepage">
<h3>Bloodrage</h3>
<span>€38.90</span>
<div class="product-info">
<p>Some information about the product!</p>
Vergelijk prijzen
</div>
</div>
</div>
A lot of your issues come from .product-info having position: absolute;. So remove that (both of them, you have position: absolute; in there twice); then you can add some padding-bottom to .product-grid to "fit" your button inside the div.
Check out what I did here:
.home-products {
width: auto;
height: 250px;
}
.product-image-home {
height: 200px;
}
.product-grid {
position: relative;
float: left;
margin-left: 3px;
margin-right: 3px;
text-align: center;
width: 225px;
padding-bottom: 15px;
}
.product-grid h3 {
margin: 0;
text-align: center;
margin-bottom: 5px;
font-size: 20px "Open Sans", Helvetica, Arial, sans-serif;
}
.product-overlay-button {
background: #85bf31;
height: 550px;
border: none;
border-radius: 2px;
color: #fff;
font-weight: bold;
font-size: 14px;
padding: 0.6em 2em;
margin-top: 5px;
text-decoration: none;
text-align: center;
}
.product-grid:hover {}
.product-info {
display: none;
width: 225px;
text-align: center;
float: left;
margin-left: 3px;
margin-right: 3px;
}
.product-info p {
margin-left: 7px;
margin-right: 7px;
}
.product-grid:hover .product-info {
display: block;
}
.product-grid:hover {
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
<div class="home-products">
<div class="product-grid">
<img class="product-image-home" src="https://cardpile.nl/wp-content/uploads/2021/04/blood-rage-460x460.jpg" alt="Homepage">
<h3>Bloodrage</h3>
<span>€38.90</span>
<div class="product-info">
<p>Some information about the product</p>
Vergelijk prijzen
</div>
</div>
</div>
You can use shadow settings similar to 0px 0px 10px 4px (i.e. the first and second values are zero, so the shadow will be spread equally on all sides according to the third and fourth values):
.home-products {
width: auto;
height: 250px;
}
.product-image-home {
height: 200px;
}
.product-grid {
position: relative;
float: left;
margin-left: 3px;
margin-right: 3px;
text-align: center;
width: 225px;
}
.product-grid h3 {
margin: 0;
text-align: center;
margin-bottom: 5px;
font-size: 20px "Open Sans", Helvetica, Arial, sans-serif;
}
.product-overlay-button {
background: #85bf31;
height: 550px;
border: none;
border-radius: 2px;
color: #fff;
font-weight: bold;
font-size: 14px;
padding: 0.6em 2em;
margin-top: 5px;
text-decoration: none;
text-align: center;
}
.product-grid:hover {}
.product-info {
display: none;
position: absolute;
width: 225px;
position: absolute;
text-align: center;
float: left;
margin-left: 3px;
margin-right: 3px;
}
.product-info p {
margin-left: 7px;
margin-right: 7px;
}
.product-grid:hover .product-info {
display: block;
}
.product-grid:hover {
box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.2);
z-index: 1;
}
<div class="home-products">
<div class="product-grid">
<img class="product-image-home" src="https://cardpile.nl/wp-content/uploads/2021/04/blood-rage-460x460.jpg" alt="Homepage">
<h3>Bloodrage</h3>
<span>€38.90</span>
<div class="product-info">
<p>Some information about the product!</p>
Vergelijk prijzen
</div>
</div>
</div>
Related
I am making a sidebar for my site and I want the side bar to fill the rest of the screen but also scroll separate to the right of the screen when it overflows with other elements inside. When I use 100% for the height the element only goes to the height of the last element inside of it.
I am trying to get it to fill the rest of the screen as I stated previously but it only goes to not all the way.
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.main {
margin-left: 345px;
border: 0px solid #ffffff;
padding: 0px 0px;
flex-direction: column;
align-content: center;
text-align: center;
width: 450px;
}
.card {
display: inline-block;
width: 400px;
height: 160px;
background-color: #404040;
border: 1px solid #404040;
border-radius: 4px;
margin: 0px;
margin-top: 20px;
text-decoration: none;
}
.toptext {
display: inline-block;
width: 400px;
height: 45px;
color: #ffffff;
background-color: #ffffff;
border: 1px solid #ffffff;
border-radius: 4px;
margin: 0px;
margin-top: 5px;
text-decoration: none;
text-align: left;
}
.toptext h1 {
font-size: 20px;
margin-left: 0px;
margin-top: 1px;
color: #404040;
}
.toptext p {
font-size: 12px;
margin-left: 0px;
margin-top: -10px;
color: #404040;
}
.flexcolumn {
flex-direction: column;
}
.leftmain {
height: 100%;
width: 325px;
padding: 0px 10px;
flex-direction: column;
align-content: center;
background-color: #333333;
overflow: scroll;
}
.leftmain p {
float: left;
color: #ffffff;
text-align: left;
padding: 0px 10px;
text-decoration: none;
font-size: 12px;
line-height: 25px;
border-radius: 4px;
background-color: #333333;
width: 300px;
}
.leftmain p:hover {
background-color: #404040;
color: #ffffff;
}
.header {
overflow: hidden;
background-color: #404040;
padding: 10px 10px;
height: 36px;
text-align: center;
}
.header-right {
float: right;
padding: 0px 0px;
}
.header a {
float: left;
color: #ffffff;
text-align: center;
padding: 5px 10px;
text-decoration: none;
font-size: 18px;
line-height: 25px;
border-radius: 4px;
align-content: center;
}
.header a:hover {
background-color: #333333;
color: #ffffff;
}
<div class="header">
📄 My Paper Company
<div class="header-right">
Settings
Contact
Donate
<div class="flexcolumn">
</div>
</div>
</div>
<div id="leftmain" class="leftmain">
<p id="button" div="leftmain" onclick='show("htpmain")'>📢 How To Play</p>
</div>
<center>
<div id=htpmain class="main">
<div class="toptext">
<h1>
📢 How To Play
</h1>
<p>This guide will get you start the game and will be helpful to grasp everything you need to do.
</p>
</div>
<div class="card" />
</div>
</center>
Your leftmain IS taking up 100% of the space available to it, leftmain stops when it reaches . You have leftmain set to flex-direction: column;
when only the .main should have it. Also don't use the tag, it is no longer supported in HTML5 and is display: block; when it should be inline-block.
I would change just to and set display to inline-block and set a width so the leftmain has room to go past it.
I hope this solves your problem.
.leftmain {
height: 100%;
width: 325px;
padding: 0px 10px;
align-content: center;
background-color: #333333;
overflow: scroll;
}
#nameOfCenterDiv {
position: absolute;
left: 300px;
display: inline-block;
}
Give to the sidebar a position fixed so it always stays there wherever you scroll and and a margin-left to your content on the right (the width of the margin-left must be the same of sidebar width)
.leftmain{
position: fixed
}
.main{
margin-left: 345px;
width: 450px //remove this so it's 100%
}
You have to wrap the left sidebar and right panel within the same container.
Using the display: flex on the container, you no longer need to specify a 100% height for the left sidebar since it will automatically fill in the remaining space.
You also need to remove the margin-left rule for the right content so that it lays nicely with the sidebar.
You can optionally set a max-height of 100vh to the sidebar so that it scrolls when its content exceeds the viewport height.
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.main {
border: 0px solid #ffffff;
padding: 0px 0px;
flex-direction: column;
align-content: center;
text-align: center;
width: 450px;
}
.card {
display: inline-block;
width: 400px;
height: 160px;
background-color: #404040;
border: 1px solid #404040;
border-radius: 4px;
margin: 0px;
margin-top: 20px;
text-decoration: none;
}
.toptext {
display: inline-block;
width: 400px;
height: 45px;
color: #ffffff;
background-color: #ffffff;
border: 1px solid #ffffff;
border-radius: 4px;
margin: 0px;
margin-top: 5px;
text-decoration: none;
text-align: left;
}
.toptext h1 {
font-size: 20px;
margin-left: 0px;
margin-top: 1px;
color: #404040;
}
.toptext p {
font-size: 12px;
margin-left: 0px;
margin-top: -10px;
color: #404040;
}
.flexcolumn {
flex-direction: column;
}
.container {
display: flex;
}
.leftmain {
width: 325px;
padding: 0px 10px;
flex-direction: column;
align-content: center;
background-color: #333333;
overflow: scroll;
}
.leftmain p {
float: left;
color: #ffffff;
text-align: left;
padding: 0px 10px;
text-decoration: none;
font-size: 12px;
line-height: 25px;
border-radius: 4px;
background-color: #333333;
width: 300px;
}
.leftmain p:hover {
background-color: #404040;
color: #ffffff;
}
.header {
overflow: hidden;
background-color: #404040;
padding: 10px 10px;
height: 36px;
text-align: center;
}
.header-right {
float: right;
padding: 0px 0px;
}
.header a {
float: left;
color: #ffffff;
text-align: center;
padding: 5px 10px;
text-decoration: none;
font-size: 18px;
line-height: 25px;
border-radius: 4px;
align-content: center;
}
.header a:hover {
background-color: #333333;
color: #ffffff;
}
<div class="header">
📄 My Paper Company
<div class="header-right">
Settings
Contact
Donate
<div class="flexcolumn">
</div>
</div>
</div>
<div class="container">
<div id="leftmain" class="leftmain">
<p id="button" div="leftmain" onclick='show("htpmain")'>📢 How To Play</p>
</div>
<center>
<div id=htpmain class="main">
<div class="toptext">
<h1>
📢 How To Play
</h1>
<p>This guide will get you start the game and will be helpful to grasp everything you need to do.
</p>
</div>
<div class="card" />
</div>
</center>
</div>
Currently for my site I am building a product grid that is supposed to show more information when you hover over it. But now when I hover over my product the layout of my site changes. How can I make it that it will show my information without changing the layout?
.home-products {
width: auto;
height: 250px;
}
.product-image-home {
height: 200px;
}
.product-grid {
position: relative;
float: left;
margin-left: 3px;
margin-right: 3px;
text-align: center;
width: 225px;
}
.product-grid h3 {
margin: 0;
text-align: center;
margin-bottom: 5px;
font-size: 20px "Open Sans", Helvetica, Arial, sans-serif;
}
.product-info p {
margin-left: 7px;
margin-right: 7px;
}
.product-overlay-button {
background: #85bf31;
border: none;
border-radius: 2px;
color: #fff;
font-weight: bold;
font-size: 14px;
padding: 0.6em 2em;
margin-top: 5px;
margin-bottom: 15px;
text-decoration: none;
text-align: center;
}
.product-grid:hover {
width: 225px;
height: 440px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
text-align: center;
float: left;
margin-left: 3px;
margin-right: 3px;
}
.product-info {
display: none;
}
.product-grid:hover .product-info {
display: block;
}
<div class="home-products">
<div class="product-grid">
<img class="product-image-home" src="https://cardpile.nl/wp-content/uploads/2021/04/blood-rage-460x460.jpg" alt="Homepage">
<h3>Bloodrage</h3>
<span>€38.90</span>
<div class="product-info">
<p>Some information text</p>
CTA
</div>
</div>
</div>
My boss is having me update the company website since I know a little code, but I'm having trouble making the images bigger. This is the html code on the page:
<!----******* The Second Title Section -->
<!--<div style="width: 95%;overflow: hidden; margin:0 auto;" >
<div class="rightProduct">
<p class="partsTitle">Part Numbers and Manufacturers</p>
</div>
</div>-->
<!----******* The main product Section-->
<div class="apartmentInnerWrapper">
<div class="leftProduct">
<div class="flexslider">
<ul class="slides">
<li>
<img src="https://efuses.com/wp-content/uploads/2018/11/copper-bus-bar-500x500.jpg" alt="H05" width="320" height="240"/>
</li>
</ul>
</div>
</div>
<div class="rightProduct">
<br></br> <p class="categoryTitle">Copper Busbar - In Stock and Ready for Immediate Shipment</p>
<p class="communityHeader">
</p>
<div class="fuseDescription">
<span class="fuseDescriptionP">
<br>Cut to Length</br>
<br>Bent and Drilled to Your Specs</br>
<br>Custom Fabrication</br>
</span>
<span><br>
<img src="https://efuses.com/wp-content/uploads/2018/11/H05WhiteBG.jpg" alt="H05" class="myimage" />
<img src="https://efuses.com/wp-content/uploads/2018/11/H02WhiteBG.jpg" alt="H02" class="myimage" /></br>
</span>
<p></p>
<img src="https://efuses.com/wp-content/uploads/2016/06/Express_Shipping-150.png"><span>In Stock Item & Ready to Ship</span>
<p class="chatLink">For Instant Quote - Open the Chat Below<br>
Or Email Us at
<a href="#contact_form_pop" class="fancybox talkPerson" >quote#powerfuse.com</a><br>
Or Call Us at
<span class="number talkPerson">918-665-6888</span>
And here is the CSS script:
/*************
community Page CSS
************/
/* Contact Form */
.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 textarea
{
background-color: #fff;
border: 2px solid #2F3396;
color: #000;
width: 90%;
}
.site-header {
display: none;
}
.flexslider {
max-width: 600px;
margin: 0 auto 60px !important;
}
.site-inner {
padding: 0px !important;
max-width: 3000px !important;
}
a {
border-bottom: none !important;
text-decoration: none !important;
}
.communityMobileContainer {
display: none;
}
.communityContainer {
width: 100%;
margin: 0;
padding: 0px 0px 0px 0px;
overflow: hidden;
}
.apartmentInnerWrapper {
width: 85%;
display: block;
margin-left: auto;
margin-right: auto;
overflow: hidden;
padding: 10px 0px 20px 0px;
}
/*********************
Community Header
*********************/
.apartmentBanner {
width: 100%;
overflow: hidden;
display: block;
margin-left: auto;
margin-right: auto;
padding: 10px 0;
}
.topBanner {
background-color: #2F3396;
height: 100px;/*F8C800*/
}
.bottomBanner {
background-color: #C1D0D3;
width: 100%;
padding: 5px 0;
/*position: relative;
top: -40px;*/
}
.bottomBanner a {
color: #2F3396 !important;
}
.apartmentPets,
.apartmentBannerMap,
.apartmentBannerPrice {
float: left;
width: 33%;
text-align: center;
font-weight: 600;
font-size: 16px;
color: #fff;
}
.apartmentPets1,
.apartmentBannerMap1 {
float: left;
width: 25%;
text-align: center;
font-weight: 600;
font-size: 16px;
color: #fff;
}
.apartmentBannerPrice1 {
float: left;
width: 50%;
text-align: center;
font-weight: 600;
font-size: 16px;
color: #fff;
}
.apartmentPets a {
color: #fff;
}
.communityViewMap a {
color: #fff;
}
.talkSection > a{
padding-top: 10px !important;
color: #C1D0D3;
font-size: 30px;
}
.talkSection > a:hover {
color: #fff;
}
.talkSection .powerFuseBottom {
position: relative;
top: -29px;
}
.apartmentBannerMap {
padding-top: 4px;
}
.talkPerson {
font-size: 18px !important;
font-weight: 600 !important;
padding: 5px 10px 5px 0px !important;
border: 0 !important;
top: 0px !important;
color: #c3251d;
text-decoration: underline !important;
}
.communityViewMap .talkPerson {
font-size: 18px !important;
font-weight: 600 !important;
padding: 5px 10px 5px 0px !important;
border: 0 !important;
top: 0px !important;
color: #2F3396;
text-decoration: none !important;
}
a:hover {
color: #000;
cursor: pointer;
}
.apartmentPets {
padding-top: 4px;
}
/* End Banner */
.rightProduct .partsTitle {
margin: 10px 0 0px;
font-size: 24px;
font-weight: 400;
}
.learnAboutFact {
margin: 10px 0 0px;
font-size: 32px;
font-weight: 400;
color: #2F3396;
text-align: center;
display: block;
}
/* Product Desciption */
.communityContainer .categoryTitle {
font-size: 30px;
font-weight: 600;
text-decoration: none;
color: #2F3396;
margin: 0px;
}
.communityContainer .categoryFuseTitle {
font-size: 26px;
font-weight: 600;
text-decoration: none;
color: #2F3396;
margin: 0px;
padding: 35px 0 20px;
}
.communityContainer .leftProduct {
padding: 3px 12px;
width: 45%;
float: left;
overflow: hidden;
}
.communityContainer .leftProduct img {
display: block;
margin-left: auto;
margin-right: auto;
margin-top: 50px;
}
.communityContainer .rightProduct {
padding: 3px 12px;
width: 53%;
float: right;
overflow: hidden;
}
.fuseDescriptionP {
font-size: 22px;
font-weight: 500;
color: #000;
margin-bottom: 0px;
}
.fuseDescriptionP p {
margin-bottom: 0px;
}
.contactUsBanner{
text-align: center;
font-size: 22px;
font-weight: 500;
color: #000;
}
.contactUsBanner a {
padding: 10px 15px;
color: #000;
}
.contactUsBanner a:hover {
color: #2F3396;
}
/* End Product Description */
.communityContainer .communityHeader {
padding: 2px 12px 0 0;
margin: 0 0 0 0;
width: 100%;
float: left;
text-align: left;
}
.communityContainer .communityHeader .communityTitle {
font-size: 30px;
font-weight: 600;
text-decoration: none;
color: #2F3396;
}
.communityContainer .fuseDescription p {
font-size: 16px;
}
/*********************
Community Description Section
*********************/
.communityContainer .fuseDescription{
width: 100%;
overflow: hidden;
padding: 0px 10px 5px 0px;
}
.communityContainer .fuseDescription myimages {
width: 400px;
height: 300px;
}
.communityContainer .fuseDescription span {
font-size: 20px;
font-weight: 400;
position: relative;
top: -15px;
padding: 0 0 0 15px;
}
.communityContainer .fuseDescription .chatLink {
font-size: 24px;
font-style: italic;
font-weight:600;
margin-bottom: 2px;
}
.communityContainer .fuseDescription p{
font-size: 16px;
}
.communityDescriptionHalf {
float: left;
width: 48%;
padding: 0px 4px;
}
.communityDescriptionThird {
float: left;
width: 32%;
padding: 0px 4px;
}
.communityDescription .communityPlansTitle {
padding: 3px 0 20px 0px;
width: 100%;
display: block;
clear: left;
}
.communityPlansDataLeft,
.communityPlansDataRight {
width: 48%;
float: left;
font-size: 16px;
font-weight: 400;
padding: 0 10px!important;
}
.communityPlansInfo h4{
font-size: 24px;
color: #004c71;
margin: 5px 0 2px 0 !important;
padding: 0 10px!important;
font-weight: 700;
text-align: center;
}
.communityPlansInfo p {
font-size: 18px;
margin: 0px 0 4px 0 !important;
padding: 0 10px!important;
font-weight: 600;
color: #000;
}
/* Footer */
.footer-widgets {
padding: 0px;
background-color: #C1D0D3;
}
.footer-widgets .wrap {
padding: 0px;
margin: 0px;
max-width: 3000px;
color: #fff;
}
.footer-widgets .wrap a {
padding: 0px;
margin: 0px;
max-width: 3000px;
color: #fff;
}
.footer-widgets-1 {
width: 100%;
float: left;
padding: 20px 4%;
text-align: center;
margin: 0px;
font-size: 22px;
color: #2F3396;
}
.footer-widgets-1 p {
margin-top: 5px;
margin-bottom: 20px;
}
.footer-widgets-1 .widgettitle {
text-align: center;
color: #2F3396;
}
.footer-widgets-2 {
width: 50%;
float: left;
padding: 20px 4% 0px;
margin: 0px;
font-size: 18px;
color: #2F3396;
}
.footer-widgets-2 .widgettitle {
color: #2F3396;
}
.footer-widgets-1 a:hover,
.footer-widgets-2 a:hover {
color: #000;
}
.footer-widgets-3{
width: 20%;
float: left;
padding: 20px 4% 0px;
margin: 0px;
font-size: 18px;
}
.footer-widgets-3 .widgettitle {
color: #2F3396;
}
.footer-widgets .widget {
margin-bottom: 10px;
}
.widgettitle {
text-align: center;
padding-top: 10px;
margin-bottom: 10px;
font-size: 32px;
}
.site-footer {
background-color: #23282D;
color: #fff;
}
.site-footer a {
color: #fff;
}
/*********************
Mobile CSS
*********************/
#media (max-width: 1000px) {
.communityContainer .communityPhone {
text-align: center;
width: 100%;
padding: 12px 0;
clear: both;
}
.footer-widgets-1,
.footer-widgets-2,
.footer-widgets-3{
width: 100%;
clear: left;
text-align: center;
}
.widgettitle {
text-align: center !important;
padding-top: 20px;
}
.communityContainer .communityUrl {
text-align: center;
width: 100%;
padding: 12px 0;
clear: both;
}
}
#media (max-width: 800px) {
.apartmentInnerWrapper {
width: 100%;
padding-top: 25px;
}
.topBanner {
height: 190px;
}
.apartmentPets,
.apartmentBannerPrice,
.apartmentBannerMap {
clear: left;
width: 100%;
text-align: center;
font-weight: 600;
font-size: 18px;
}
.communityDescriptionHalf {
clear: left;
width: 100%;
}
.communityDescriptionThird {
clear: left;
width: 100%;
}
.communityContainer .leftProduct {
clear: both;
width: 100%;
}
.communityContainer .rightProduct {
clear: both;
width: 100%;
padding: 0 0 25px 0;
}
.communityContainer .communityHeader {
width: 100%;
}
.communityContainer .communityHeader .communityBuilder {
padding: 6px 3px;
}
}
#media (max-width: 700px) {
.communityMobileContainer {
display: inline-block!important;
}
.communityContainer {
display: important;
}
#communityPlansAll {
width: 100%;
max-width: 500px;
margin: 2px auto 2px auto;
}
/*********************
End Mobile CSS
*********************/
}
/*******************
*******************
Fuse Category Page
*******************
*******************/
.allAgentsWrapper {
width: 100%;
padding: 0 0 75px;
overflow: hidden;
}
.allAgentsWrapper .allAgents {
width: 100%;
margin: 0 auto;
max-width: 1000px;
overflow: hidden;
padding: 40px 0;
list-style: none;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
justify-content: space-around;
}
.singleAgent {
padding: 20px 10px;
width: 200px;
height: auto;
}
.singleAgent .bpTitle{
text-align: center;
font-size: 16px;
padding-bottom: 0px;
margin-bottom: 0px;
margin-top: 7px;
color: #606060;
font-family: Oswald,Tahoma,Arial,sans-serif;
}
.singleAgent .bpImg {
width: 100%;
height: auto;
border: 1px solid #f6f6f6;
}
.singleAgent .fuseImageWrapper {
overflow: hidden;
min-height: 144px;
}
.singleAgent .bpDesc p {
font-size: 12px;
font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif;
line-height: 17px;
text-align: justify;
font-size: 12px;
margin-top: 5px;
margin-bottom: 5px;
}
.singleAgent .AgentTop {
width: 100%;
padding: 5px 0;
}
.singleAgent .AgentTop .leftTop {
float: left;
width: 50%;
margin: 0;
padding: 5px 0;
}
.singleAgent .AgentTop .rightTop {
float: right;
width: 50%;
margin: 0;
padding: 5px 0;
}
.singleAgent .bpPrice {
font-size: 16px;
text-align: center;
padding: 5px 0 0;
letter-spacing: 1px;
font-family: Oswald,Tahoma,Arial,sans-serif;
}
.singleAgent .bpLink {
padding: 7px 11px;
float: right;
font-size: 16px;
font-weight: 600;
color: #fff;
font-weight: 400;
text-decoration: none;
background-color: #faab37;
border-radius: 0;
font-family: Oswald,Tahoma,Arial,sans-serif;
text-shadow: 1px 1px rgba(0,0,0,.25);
border: 0;
outline: 0;
-moz-transition: all .2s ease-in;
-o-transition: all .2s ease-in;
-webkit-transition: all .2s ease-in;
transition: all .2s ease-in;
}
.singleAgent .bpLink:hover {
background-color: #000;
}
.singleAgent .bpIcons {
list-style: none;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
justify-content: center;
}
.singleAgent .bpIcon i {
font-size: 18px;
padding: 0 5px;
}
/* Single Agent Page */
.singleWrapper .topImage {
padding: 15px;
}
.singleWrapper .topSection {
padding: 5px 15px 15px;
}
.singleWrapper .topSection .bpTitle {
padding: 5px 0;
}
.singleWrapper .topSection .bpDesc {
padding: 5px 0 15px;
}
.singleWrapper .topSection .bpLink {
float: left;
padding: 7px 11px;
margin-top: 10px;
font-size: 16px;
font-weight: 600;
color: #fff;
font-weight: 400;
text-decoration: none;
background-color: #faab37;
border-radius: 0;
font-family: Oswald,Tahoma,Arial,sans-serif;
text-shadow: 1px 1px rgba(0,0,0,.25);
border: 0;
outline: 0;
-moz-transition: all .2s ease-in;
-o-transition: all .2s ease-in;
-webkit-transition: all .2s ease-in;
transition: all .2s ease-in;
}
.singleWrapper .topSection .bpPrice {
margin-left: 10px;
float: left ;
color: #606060;
font-size: 20px;
padding: 16px 0 0;
letter-spacing: 1px;
font-family: Oswald,Tahoma,Arial,sans-serif;
}
.singleWrapper .leftImage {
max-width: 300px;
}
.singleWrapper .rightSection {
max-width: 500px;
}
.singleWrapper .bpIcon i {
font-size: 22px;
padding: 0 5px 15px;
}
I tried adding this bit of code to the Community Description Section on the CSS file to see if it would work but it didn't.
.communityContainer .fuseDescription myimages {
width: 400px;
height: 300px;
}
Basically I'm flummoxed. Any help would be appreciated.
Here is a link to the page:
https://efuses.com/copperbusbar/
The two images in question are underneath the words Custom Fabrication.
Thanks!
I am inferring that since you have 2 images, you want to align them next to each other and have them occupy roughly half of the available space each. So a solution could be:
.communityContainer .fuseDescription img { display: inline-block; width: 49%; height: auto; }
First, you need a selector that correctly references and overwrites the current context, hence the 2 classes and an element. Then, displaying the images as inline-blocks allows them to respect the width and height specifications in all browsers. A width of 49% makes sure they both fit in a row snugly without pressing the outer margins. Height auto insures they keep their original proportion and don't get skewed.
Your error was the myimages selector which doesn't really exist in CSS, except if you wanted to specify the class name .myimages which would have also worked. The difference in approaches when using percentages vs pixels is the fact that the percentages adapt to the screen real estate available in varying contexts and browser sizes.
There are some other more advanced solutions based on the CSS grid specification that do the same trick for a variable amount of images on one "line" but I'm guessing you don't need that sort of complexity to solve this particular issue. :)
I have this website with a showcase div, within the div I have a "Get Started" button. I am able to vertically align the button with the margin attribute. However I do not want to horizontally align the button with margin as this will lead to some trouble for me in the future, I've tried align: center; and align="center" but the button sticks to the left side of the showcase. How can I unstick this button and horizontally align it without having to use a margin attribute?
html,
body,
header {
position: absolute;
left: 0;
top: 0;
width: 100%;
margin: 0;
margin-top: 0;
margin: auto;
padding: 0;
}
h1 {
display: inline-block;
font-family: Trebuchet MS;
font-size: 75px;
letter-spacing: 3px;
margin: 10px 0px 0px 20px;
}
h2 {
display: inline-block;
flex-direction: row;
margin: 0px 0px 0px 50px;
font-family: Georgia;
}
.highlight {
color: #45d845;
}
.heading {
background-color: #d84545;
border-bottom: 5px solid black;
padding-top: 20px;
padding-bottom: 20px;
}
#comet {
font-size: 65px;
margin-left: 20px;
}
.showcase {
background: url('background1.jpeg');
border-bottom: 5px solid black;
height: 1000px;
width: 100%;
background-size: 100% 100%;
background-repeat: no-repeat;
color: #cccccc;
}
.showcase h2 {
color: #fff;
margin-top: 170px;
font-size: 60px;
font-family: Verdana;
text-align: center;
text-shadow: 1px 3px #000;
}
#start {
align: center;
margin-top: 130px;
background-color: transparent;
color: #fff;
padding: 20px 30px 20px 30px;
text-align: center;
font-family: Helvetica;
font-weight: bold;
border-radius: 10px;
-webkit-transition-duration: 0.4s;
transition-duration: 0.4s;
}
#start:hover {
cursor: pointer;
background-color: #fff;
color: #000;
}
<header>
<div class="heading">
<h1>ThumbTac <span id="comet">☄</span> </h1>
</div>
</header>
<div class="showcase">
<h2>He moonlight difficult engrossed an it sportsmen. Interested has all devonshire difficulty jay assistance joy. Unaffected at ye </h2>
<button id="start" align="center">Get Started</button>
</div>
You can wrap your button in a div with the style text-align: center; to horizontally center your button. Example:
html, body, header{
position:absolute;
left:0;
top:0;
width: 100%;
margin: 0;
margin-top: 0;
margin: auto;
padding: 0;
}
/*Heading*/
h1{
display: inline-block;
font-family: Trebuchet MS;
font-size: 75px;
letter-spacing: 3px;
margin: 10px 0px 0px 20px;
}
h2{
display: inline-block;
flex-direction: row;
margin: 0px 0px 0px 50px;
font-family: Georgia;
}
.highlight{
color: #45d845;
}
.heading{
background-color: #d84545;
border-bottom: 5px solid black;
padding-top: 20px;
padding-bottom: 20px;
}
#comet{
font-size: 65px;
margin-left: 20px;
}
/*Showcase*/
.showcase{
background: url('background1.jpeg');
border-bottom: 5px solid black;
height: 1000px;
width: 100%;
background-size: 100% 100%;
background-repeat: no-repeat;
color: #cccccc;
}
.showcase h2{
color: #fff;
margin-top: 170px;
font-size: 60px;
font-family: Verndana;
text-align: center;
text-shadow: 1px 3px #000;
}
#start{
align: center;
margin-top: 130px;
background-color: transparent;
color: #fff;
padding: 20px 30px 20px 30px;
text-align: center;
font-family: Helvetica;
font-weight: bold;
border-radius: 10px;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
}
#start:hover{
cursor: pointer;
background-color: #fff;
color: #000;
}
<header>
<div class="heading">
<h1>ThumbTac <span id="comet">☄</span> </h1>
</div>
</header>
<div class="showcase">
<h2>He moonlight difficult engrossed an it sportsmen.
Interested has all devonshire difficulty jay
assistance joy. Unaffected at ye </h2>
<div style="text-align: center;">
<button id="start">Get Started</button>
</div>
</div>
You can consider using a flexbox. Documentation in the CSS source.
/* Global Sets */
html,
body,
header {
position: absolute;
left: 0;
top: 0;
width: 100%;
margin: 0;
margin-top: 0;
margin: auto;
padding: 0;
}
/*Heading*/
h1 {
display: inline-block;
font-family: Trebuchet MS;
font-size: 75px;
letter-spacing: 3px;
margin: 10px 0px 0px 20px;
}
h2 {
display: inline-block;
flex-direction: row;
margin: 0px 0px 0px 50px;
font-family: Georgia;
}
.highlight {
color: #45d845;
}
.heading {
background-color: #d84545;
border-bottom: 5px solid black;
padding-top: 20px;
padding-bottom: 20px;
}
#comet {
font-size: 65px;
margin-left: 20px;
}
/*Showcase*/
.showcase {
background: url('background1.jpeg');
border-bottom: 5px solid black;
height: 1000px;
width: 100%;
background-size: 100% 100%;
background-repeat: no-repeat;
color: #cccccc;
display: flex; /* Added */
flex-direction: column; /* Added */
align-items: center; /* Added, horizonal alignment */
}
.showcase h2 {
color: #fff;
margin-top: 170px;
font-size: 60px;
font-family: Verndana;
text-shadow: 1px 3px #000;
text-align: center;
}
#start {
/* align: center; Not valid CSS */
margin-top: 130px;
background-color: transparent;
color: #fff;
padding: 20px 30px 20px 30px;
/* text-align: center; No longer required */
font-family: Helvetica;
font-weight: bold;
border-radius: 10px;
-webkit-transition-duration: 0.4s;
/* Safari */
transition-duration: 0.4s;
}
#start:hover {
cursor: pointer;
background-color: #fff;
color: #000;
}
<header>
<div class="heading">
<h1>ThumbTac <span id="comet">☄</span> </h1>
</div>
</header>
<div class="showcase">
<h2>He moonlight difficult engrossed an it sportsmen. Interested has all devonshire difficulty jay assistance joy. Unaffected at ye </h2>
<button id="start" align="center">Get Started</button>
</div>
Could anybody help me and have a look at my HTML page, and explain to me if this is a correct semantic way to set-up a HTML page?
I need to learn to build a webpage with as less divs as possible, but you can use them if you want to style something specific right? like I used them in this context.
So are there any any flaws in my HTML code?
.main-club-bar-music-festival {
overflow: auto;
}
.main-club-bar-music-festival h3 {
margin: 0;
}
.img-club-air {
position: relative;
}
.img-club-air img {
width: 100%;
}
.img-club-air a:first-child {
position: absolute;
margin: 10px;
width: 60px;
right: 0;
bottom: 0;
z-index: 1;
}
.img-club-air h2 {
position: absolute;
bottom: 0;
font-size: 20px;
width: 100%;
padding: 10px;
color: white;
font-family: "LemonMilk"
}
#paragraph-p {
padding: 20px;
margin: 0;
}
.rent-a-bike {
width: 200px;
margin: 20px auto;
text-align: center;
background-color: #eb6c74;
}
.rent-a-bike p {
margin: 0;
padding: 10px;
color: white;
text-transform: capitalize;
transform: translateX(-5%);
overflow: hidden;
}
.rent-a-bike img {
margin-top: 10px;
margin-left: 5px;
height: 38px;
float: left;
}
.show-me-the-way {
width: 200px;
margin: 20px auto;
text-align: center;
background-color: #eb6c74;
}
.show-me-the-way p {
margin: 0;
padding: 10px;
color: white;
text-transform: capitalize;
}
.show-me-the-way img {
height: 38px;
float: left;
}
.info-block {
background-color: #eb6c74;
color: white;
padding: 10px 20px;
text-transform: uppercase;
font-family: "NeueHaasGrotesk Light";
}
.address-club {
overflow: auto;
margin-bottom: 16px;
}
.address-club p {
padding: 10px 20px 0 20px;
margin-bottom: 0;
}
.address-club img {
height: 40px;
margin-left: 10px;
float: left;
margin-right: 10px;
}
.address-club a {
line-height: 40PX;
display: block;
color: #3b3b3b;
text-decoration: underline;
}
.address-club a[target=_blank] {
padding-left: 20px;
color: #0000EE;
}
.padding-info-club {
padding: 20px;
}
.regular-info-left {
float: left;
width: 49.5%;
text-align: center;
color: white;
}
.regular-info-left p:nth-child(1) {
margin: 0;
}
.regular-info-left p:nth-child(2) {
margin: 2px 0;
}
.regular-info-left p:nth-child(3) {
margin: 2px 0;
}
.regular-info-left p {
background-color: #3b3b3b;
height: 50px;
line-height: 50px;
text-transform: uppercase;
}
.regular-info-right {
float: right;
width: 49.5%;
text-align: center;
color: white;
}
.regular-info-right p:nth-child(1) {
margin: 0;
}
.regular-info-right p:nth-child(2) {
margin: 2px 0;
}
.regular-info-right p:nth-child(3) {
margin: 2px 0;
}
.regular-info-right p {
background-color: #3b3b3b;
height: 50px;
line-height: 50px;
text-transform: uppercase;
}
#overflow-regular-info {
overflow: auto;
}
.info-feedback-on-page {
margin: 10px 0;
border-top: 1px solid #eb6c74;
border-bottom: 1px solid #eb6c74;
padding: 0px 0px 10px 20px;
}
.info-feedback-on-page button {
border-radius: 40%;
background-color: transparent;
margin-right: 10px;
}
#button-yes {
background-color: white;
border-radius: 28px;
border: 2px solid #44c767;
color: #44c767;
font-size: 15px;
padding: 10px 25px;
outline: 0;
}
#button-yes:active {
position: relative;
top: 2px;
outline: 0;
}
#button-no {
background-color: white;
border-radius: 28px;
border: 2px solid #e35656;
color: #e35656;
font-size: 15px;
padding: 10px 25px;
outline: 0;
}
#button-no:active {
position: relative;
top: 2px;
outline: 0;
}
<main class="main-club-bar-music-festival">
<div class="img-club-air">
<img src="img/favorite-icon-add.svg" alt="add to favourites">
<img src="img/club-panama.jpg" alt="Club Panama">
<h2>panama</h2>
</div>
<h3 class="info-block">regular info</h3>
<section id="overflow-regular-info">
<div class="regular-info-left">
<p>dancing</p>
<p>go out with mates</p>
<p>expensive</p>
</div>
<div class="regular-info-right">
<p>edm</p>
<p>locals/foreigners</p>
<p>groups</p>
</div>
</section>
<p id="paragraph-p">Panama chose a bit of a peculiar spot to open a nightclub. Located outside the city centre, Panama created a diversified nightclub. The nightclub holds a lot of parties varying from electronic tp 80's and 90s parties. Panama also houses HappyHappyJoyJoy, an asian shared dining restaurant</p>
<div class="rent-a-bike">
<a href="http://www.ov-fiets.nl/huurlocaties?locatie=amsterdam&POST_AUTOCOMPLETE=%2Fhuurlocaties.xml" target="_blank">
<img src="img/bicycle-icon.svg" alt="OV-Bicycle">
<p>rent ov-bike
<br>€ 3,85,-/24 hour</p>
</a>
</div>
<div class="show-me-the-way">
<a href="">
<img src="img/location-icon.svg" alt="your location to destination">
<p>show me the way</p>
</a>
</div>
<h3 class="info-block">average price for a drink</h3>
<p class="padding-info-club">- € 2,30,-</p>
<h3 class="info-block">entrance</h3>
<p class="padding-info-club">- € 5,00,-</p>
<h3 class="info-block">address</h3>
<div class="address-club">
<p>Panama
<br> Oostelijke Handelskade 4
</p>
www.panama.nl
020 311 86 86<img src="img/phone-icon.svg" alt="call-icon">
</div>
<h3 class="info-block">opening hours</h3>
<p class="padding-info-club">Fr - Su: 21:00 - 05:00pm</p>
<div class="info-feedback-on-page">
<p>Was this information usefull for you as an international student?</p>
<button id="button-yes">yes</button>
<button id="button-no">no</button>
</div>
</main>