so I've been looking around for the solution to this problem and I haven't been able to find a clear or really any answers at all (maybe I just don't know how to word the question?). So, I'm really going to rely on pictures for this question and then explain what is going on.
Starting position of chrome dev tools
Above is the starting position of the element (the content just above the dev tools). At this position, the elements are functioning as they should, however on resizing the dev tools, the elements move up or down. In the next picture, I increased the size of the dev tools and the elements in question move with the tools.
Expanded size of chrome dev tools
As you can see in the picture above, when I resize the dev tools, the page elements and next button moves almost like it's attached to the dev tools.
What really confuses me is that I haven't used css on any part of the in questioned elements. And what confuses me even more is the fact that no other element on the page reacts the same way as the element in question (which again is the very last elements on the page).
Below is my html and SCSS code:
HTML:
<section class="section__shopping-items quarter-margin">
<div class="item-content flex-wrapper">
<div class="shop-list">
<img
src="../../public/css/img/3-stripes-shorts-black.jpg"
alt="pants"
class="item-img"
/>
<div class="item-info">
<p class="gender-collection">
Women's Originals
</p>
<p class="item--name">3-stripes shorts</p>
<p class="item--price">
$45
</p>
<p class="item--colors">
2 colors
</p>
</div>
</div>
<div class="shop-list">
<img
src="../../public/css/img/3-stripes-shorts-black.jpg"
alt="pants"
class="item-img"
/>
<div class="item-info">
<p class="gender-collection">
Women's Originals
</p>
<p class="item--name">3-stripes shorts</p>
<p class="item--price">
$45
</p>
<p class="item--colors">
2 colors
</p>
</div>
</div>
<div class="shop-list">
<img
src="../../public/css/img/3-stripes-shorts-black.jpg"
alt="pants"
class="item-img"
/>
<div class="item-info">
<p class="gender-collection">
Women's Originals
</p>
<p class="item--name">3-stripes shorts</p>
<p class="item--price">
$45
</p>
<p class="item--colors">
2 colors
</p>
</div>
</div>
<div class="shop-list">
<img
src="../../public/css/img/3-stripes-shorts-black.jpg"
alt="pants"
class="item-img"
/>
<div class="item-info">
<p class="gender-collection">
Women's Originals
</p>
<p class="item--name">3-stripes shorts</p>
<p class="item--price">
$45
</p>
<p class="item--colors">
2 colors
</p>
</div>
</div>
</div>
</section>
<section class="section__next-page quarter-margin">
<div class="flex-wrapper space-flex">
<div class="page--select">
<div class="flex-wrapper">
<p>Page:</p>
<div class="select-page flex-wrapper">
<p class="page--num">1 <span>⌄</span></p>
<p class="page--length">of 9</p>
</div>
</div>
</div>
<div class="page--next">
<button class="next">next</button>
</div>
</div>
</section>
SCSS
// shopping items
.section {
&__shopping-items {
height: 100%;
.item-content {
cursor: pointer;
justify-content: space-between;
overflow: auto;
.shop-list {
border: .1rem solid transparent;
min-width: 25%;
// height: 25%;
img {
width: 100%;
}
.item-info {
// margin: 1rem 1rem 2rem 1rem;
margin: 0 1rem;
.gender-collection {
margin: 1rem 0;
font-size: 1.2rem;
font-weight: 100;
color: $collection-name-font;
}
.item {
&--name,
&--price {
font-weight: 300;
}
&--name {
margin-bottom: .7rem;
font-size: 1.3rem;
}
&--price {
margin-bottom: 2.5rem;
font-size: 1.2rem;
}
&--colors {
margin-bottom: 1rem;
font-size: 1.1rem;
font-weight: 300;
color: $collection-name-font;
}
}
}
}
}
.shop-list:hover {
border: .1rem solid $font-color;
}
}
}
Also a quick side note, I've not set anything on this page to position:fixed.
Any help or feedback would be greatly appreciated.
Related
I'm trying to make an informative website about the colosseum with buttons to show/hide text. I put some images with align=left so the information is next to it, but the buttons after the images are being re-aligned to. Here is what it currently looks like:
image
Here is some of the html:
<div>
<div class="buttons">
<div class="murmillo" onclick="changeGladiator('Murmillo')">
Murmillo
</div>
<div class="retiarus" onclick="changeGladiator('Retiarus')">
Retiarus
</div>
<div class="secutor" onclick="changeGladiator('Secutor')">
Secutor
</div>
</div>
<span id="gladiatorTitle"></span>:
<div id="gladiatorDescriptions">
<ul id="murmillo">
<p>
<img align="left" src="images/Murmillo.jpg" width="245px" />
A murmillo typically wears a metal helmet with a stylized fish on the crest, a rectangular shield (scutum),
and a short sword (gladius). The armor worn by a murmillo is designed to protect the head, torso, and legs,
and it is made of metal or leather. The murmillo is one of the most popular types of gladiators in ancient
Rome, and they are often pitted against other types of gladiators, such as the retiarius or secutor.
</p>
</ul>
<ul id="retiarus">
<p>
<img align="left" src="images/Retiarius.jpg" width="245px" />
A retiarius fights using a net, trident, and a small sword called a pugio. Retiarii are often pitted against
secutores, who are armed with a sword and a shield. The retiarius is lightly armed and wears little armor,
so they rely on their speed and agility to evade their opponents. Retiarii are also known for their
distinctive outfits, which include a tunic, a loincloth, and a fish-shaped helmet.
</p>
</ul>
<ul id="secutor">
<p>
<img align="left" src="images/secutor.jpg" width="245px" />
Secutors are heavily armed and trained to fight other gladiators, typically a murmillo or a retiarius. Their
armor and weaponry are designed to mimic those of a soldier, and they are known for their strong, muscular
build. They are also characterized by their helmet, which has a narrow opening that limits their vision and
makes them more reliant on their other senses. The secutor's helmet also has a crest that is shaped like a
fish, which gives them their name (secutor is Latin for "pursuer").
</p>
</ul>
</div>
</div>
<div>
<div class="buttons">
<div class="snacks" onclick="changeOther('Snacks')">
Snacks
</div>
<div class="celebrities" onclick="changeOther('Celebrities')">
Celebrities
</div>
<div class="other events" onclick="changeOther('Other Events')">
Other Events
</div>
</div>
<span id="otherTitle"></span>:
<div id="otherDescriptions">
<ul id="snacks">
<li>Olives</li>
<li> Fruits:
<ul>
<li>Figs</li>
<li>Grapes</li>
<li>Cherries</li>
<li>Blackberries</li>
<li>Peaches</li>
<li>Plums</li>
<li>Melons</li>
</ul>
</li>
<li> Nuts:
<ul>
<li>Walnuts</li>
<li>Hazelnuts</li>
<li>Pine Nuts</li>
</ul>
</li>
</ul>
<ul id="celebrities">
<li>Built during the reign of the Flavian emperors</li>
<li>In construction under Emperor Vespasian's Reign</li>
<li>Emperor Titus celebrated the opening day with 100 days of glagiatorial games</li>
<li>Emperor Commodus performed in arena</li>
</ul>
<ul id="other events">
<li>Dramas</li>
<li>Reenactments</li>
<li>Performances</li>
</ul>
</div>
</div>
And the css:
html, body {
height: 100%;
width: 100%;
margin: 0px;
overflow: hidden;
overflow-y: scroll;
background: linear-gradient(125deg, #FFCA00 0%, #FFA000 100%);
}
.title {
width: 100%;
background-color: #000000;
border-radius: 0 0 70px 70px;
color: white;
font-size: 5rem;
text-align: center;
}
.body {
margin: 50px 10%;
font-family: Arial, Helvetica, sans-serif;
}
.buttons {
display: flex;
position: relative;
right: 15px;
column-gap: 31px;
padding-bottom: 27px;
}
.buttons>* {
cursor: pointer;
background: black;
width: auto;
display: inline;
border-radius: 50px 50px 50px 50px;
padding: 10px;
color: white;
}
img:not(.title>img){
padding-right: 25px;
border-radius: 20px 20px 20px 20px;
}
Any idea on what I could do?
Wrap your divs somehow like this:
<div class="container">
<div class="image-wrapper">
<img src="" alt="">
</div>
<div class="text-wrapper">
<p>Upper description text</p>
<div class="buttons-description-wrapper">
<!-- buttons with the description they are supposed to show -->
</div>
</div>
</div>
And then the CSS would be something like this
.container {
display:flex;
flex-direction:column;
/*use those for general layout*/
/*use the following for some better positioning*/
justify-content:center; /*to center it horizontaly*/
align-items:flex-start /*to align items to the top within this container*/
}
/*setting height properties on wrappers might be needed, depends on how much text are goiing to be displaying*/
Try this and let me know.
enter image description here
when screen size is normal
problem
enter image description here
when resizing the screen
I want the text to stay on the right side of the image all the time and never overlap in desktop and mobile
html
I also used bootstrap
<div id="moreNews" class="row">
<div class="col-lg-4 row rowCard">
<div class="col-lg-4">
<img class="imageSize" src="assets\images\image-retro-pcs.jpg" alt="">
</div>
<div class="col-lg-8 moreNewsCol">
<h2 class="moreNewsH2 ">01</h2>
<h3 class="moreNewsH3 ">Reviving Retro PCs</h3>
<p class="moreNewsP ">What happens when old PCs are given modern upgrades?</p>
</div>
</div>
<div class="col-lg-4 row rowCard">
<div class="col-lg-4 moreNewsCol">
<img class="imageSize" src="assets\images\image-top-laptops.jpg" alt="">
</div>
<div class="col-lg-8 moreNewsCol">
<h2 class="moreNewsH2 ">02</h2>
<h3 class="moreNewsH3 ">Top 10 Laptops of 2022</h3>
<p class="moreNewsP ">Our best picks for various needs and budgets.</p>
</div>
</div>
<div class="col-lg-4 row rowCard">
<div class="col-lg-4">
<img class="imageSize" src="assets\images\image-gaming-growth.jpg" alt="">
</div>
<div class="col-lg-8 moreNewsCol">
<h2 class="moreNewsH2">03</h2>
<h3 class="moreNewsH3">The Growth of Gaming</h3>
<p class="moreNewsP ">How the pandemic has sparked fresh opportunities.</p>
</div>
</div>
</div>
and CSS
body {
text-align: center;
margin: 6% 12% 6% 12%;
}
#moreNews {
margin: 0;
margin-top: 5rem;
}
.imageSize {
width: 6rem;
}
.moreNewsH2{
float: right;
text-align: left;
padding-right: 85%;
color: hsl(233 8% 79%);
}
.moreNewsH3{
text-align: left;
color: black;
font-size: 1.2rem;
}
.moreNewsP{
text-align: left;
color: gray;
font-size: 0.9rem;
}
.moreNewsCol{
text-align: left;
}
.rowCard {
margin-right: 0.7rem;
}
.attribution {
margin-top: 6rem;
}
I spend hours messing with code but I didn't got the solution
I want the text to stay on the right side of the image all the time and never overlap in desktop and mobile
:root {
--clr-primary: #f9baaa;
--clr-graylight: #c13828;
--clr-graymed: #c13828;
--border-radius: 0.5rem;
}
*,
*:before,
*:after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Playfair Display", "Montserrat";
background:square(#f9baaa);
}
main {
margin: 0rem;
}
.wrapper {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 1rem;
}
.testimonial-container {
border-radius: square(--border-radius);
padding: 2rem;
width: 300px;
height: 350px;
position: relative;
margin: 0.75rem;
background: #f9baaa;
text-align: center;
}
<head>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Playfair+Display:wght#400;500;700;900&display=swap" rel="stylesheet">
</head>
<body>
<main>
<h3>Here's a summary of what we'll cover together:</h3>
<div class="wrapper">
<div class="testimonial-container">
<h3 class="testimonial">Step 1: Language</h3>
<div class="name">
<p class="name">The language and questions we use internally play a big part in our life and affect our mindset. During our first session we will uncover the language you use and questions you ask yourself.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 2: Values</h3>
<div class="name">
<p class="name">We will dedicate two sessions to getting you clarity on your values; what is important to you in life. We will also assess how these play a role in your life and how to get you more of them.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 3: Beliefs</h3>
<div class="name">
<p class="name">Our fourth and fifth sessions will be focused on understanding your beliefs. This is the time where we tackle those little voices inside your head that may be holding you back.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 4: Identity</h3>
<div class="name">
<p class="name">During the identity session we will create your identity blueprint: Who are you? What do you do? How do you choose to live?</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 5: Purpose</h3>
<div class="name">
<p class="name">We will then move on to identify your purpose. What makes you get up in the morning? Having a clear purpose can help you create goals, guide your life decisions and offer you a sense of direction.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Wrap-Up Session</h3>
<div class="name">
<p class="name">Lastly, we will end by looking at how you can move forward with this new understanding and clarity. How can you utilise what you’ve discovered to help you lead your best life?</p>
</div>
</div>
flex boxes I'm trying to align - first 1 is not aligned
Hello,
I'm trying to align my flex boxes (I have 6) - they are all aligned except for the first 1.
I have tried a few different things but quite new to this so not sure what will work. The last box was not aligning but I fixed that by inputting height: 350px.
I'm creating this on Squarespace - Paloma template.
Is someone able to offer any advice?
Thank you!
:root {
--clr-primary: #f9baaa;
--clr-graylight: #c13828;
--clr-graymed: #c13828;
--border-radius: 0.5rem;
}
*,
*:before,
*:after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Playfair Display", "Montserrat";
background:square(#f9baaa);
}
main {
margin: 0rem;
}
.wrapper {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 1rem;
}
.testimonial-container {
border-radius: square(--border-radius);
padding: 2rem;
width: 300px;
height: 350px;
position: relative;
margin: 0.75rem;
background: #f9baaa;
text-align: center;
}
<head>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Playfair+Display:wght#400;500;700;900&display=swap" rel="stylesheet">
</head>
<body>
<main>
<h3>Here's a summary of what we'll cover together:</h3>
<div class="wrapper">
<div class="testimonial-container">
<h3 class="testimonial">Step 1: Language</h3>
<div class="name">
<p class="name">The language and questions we use internally play a big part in our life and affect our mindset. During our first session we will uncover the language you use and questions you ask yourself.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 2: Values</h3>
<div class="name">
<p class="name">We will dedicate two sessions to getting you clarity on your values; what is important to you in life. We will also assess how these play a role in your life and how to get you more of them.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 3: Beliefs</h3>
<div class="name">
<p class="name">Our fourth and fifth sessions will be focused on understanding your beliefs. This is the time where we tackle those little voices inside your head that may be holding you back.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 4: Identity</h3>
<div class="name">
<p class="name">During the identity session we will create your identity blueprint: Who are you? What do you do? How do you choose to live?</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 5: Purpose</h3>
<div class="name">
<p class="name">We will then move on to identify your purpose. What makes you get up in the morning? Having a clear purpose can help you create goals, guide your life decisions and offer you a sense of direction.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Wrap-Up Session</h3>
<div class="name">
<p class="name">Lastly, we will end by looking at how you can move forward with this new understanding and clarity. How can you utilise what you’ve discovered to help you lead your best life?</p>
</div>
</div>
I want to apply one for all hover color change effect on the icon, text and button(top to bottom). At the moment hover is working separately either text and icon or button is changing color.
here is the code and also a fiddle
<div class="col-1-left">
<div class="content">
<div class="icon">
<img src="#" />
</div>
<div class="text">
<h4>
Title text
</h4>
</div>
</div>
<div class="button">
Read More
</div>
</div>
.col-1-left {
width: 100%;
background: #555;
padding: 10px;
margin: 0;
color: red;
}
.col-1-left:hover {
color: white;
}
.button a {
color: #000;
}
.button a:hover {
color: white;
}
EDIT:
Although some of the answers worked on jsfiddle, none of them worked so far on live site.. I am pasting updated HTML code structure from it as the one above was only a sample. Maybe that will help sorting this issue out. Thanks!
<div class="et_pb_column et_pb_column_1_3 col-1-left et_pb_column_93 cboxElement">
<div class="et_pb_blurb et_pb_module et_pb_bg_layout_light et_pb_text_align_center mp_m_blurb_pulse fins-color-aqua et_pb_blurb_50 et_pb_blurb_position_top">
<div class="et_pb_blurb_content">
<div class="et_pb_main_blurb_image">
<span class="et-pb-icon et-waypoint et_pb_animation_off et-animated" style="color: #28375c;">?</span>
</div>
<div class="et_pb_blurb_container">
<h4>Title</h4>
<h5>Subhead</h5>
</div>
</div>
</div>
<div class="et_pb_button_module_wrapper et_pb_module et_pb_button_alignment_center">
<a class="et_pb_button et_pb_button_26 et_pb_module et_pb_bg_layout_dark" href="#">Find Out More</a>
</div>
</div>
Please Try this,
.col-1-left:hover * {
color: white;
}
I did a code snippet for you. Please try it and confirm it is what you need.
The thing is that you need to add the hover effect to the parent, i.e. .col-1-left in order to be able to change the color to its children elements.
.col-1-left {
width: 100%;
background: #555;
padding: 10px;
margin: 0;
color: red;
}
.col-1-left:hover, .col-1-left:hover .button a {
color: white;
}
.button a {
color:#000;
}
<div class="col-1-left">
<div class="content">
<div class="icon">
<img src="#" />
</div>
<div class="text">
<h4>Title text</h4>
</div>
</div>
<div class="button">
Read More
</div>
</div>
This is what I'm trying to do, in between the two pink lines is my max width.
This is what I'm getting:
I'm getting close:
This is my HTML:
<footer>
<div class="container">
<div class="row">
<div class="col-sm-6">
<h7>GET SOCIAL WITH US!</h7>
<div class="container'>
<div class="row">
<div class="col-md-2">
<img src="img/FB_LINK.png" alt="Follow us on Facebook"></div>
<div class="col-md-2">
<img src="img/TWITTER_LINK.png" alt="Follow us on Twitter"></div>
<div class="col-md-2">
<img src="img/LINKEDIN_LINK.png" alt="Link In with Us"></div>
</div>
<div class="row">
<div class="col-sm-6"><h7>© 2016 COPYRIGHT LINE</h7></div>
</div>
</div>
</div>
</footer>
This is my CSS for this section:
footer {
height: 60px;
width: 100%;
font-size: 14px;
position: absolute;
background-color: #2A3E47;
font-family: 'Contrail One', cursive;
margin: 0px 10px 0px 10px;
text-align:center;
}
footer.a{
display:inline-block;
margin:0 auto 0 auto;
}
h7{
color:#FFF;
font-size:24px;
font-family: 'Contrail One', cursive;
text-align:center;
}
I can't seem to figure this out, I've drawn it out on a couple sheets of paper, but I can seem to style like like I'd like. Can anyone point out where I'm going wrong?
After trying your the posted code I found that you are using wrong quote pair.
Also the css you gave isn't designed to achieve the goal.
I made a working fiddle here. Check it out
HTML:
<footer>
<div class="container">
<div class="row">
<div class="col-md-6 parent">
<p>GET SOCIAL WITH US!</p>
<div class="icon">
<img src="https://myapnea.org/assets/myapnea/icons/facebook_icon-7eedcb8837293505e1d3b1494ff19c9c3842340d1dfcd193e098e2b44f34456b.png" alt="Follow us on Facebook">
<img src="http://frcgamesense.com/dnn/portals/0/Home/Twitter_icon.png" alt="Follow us on Twitter">
<img src="https://store-images.s-microsoft.com/image/apps.36749.9007199266245564.6701eae8-16d2-4ba0-bdaa-8d9d9f9a1e70.03e5f6a9-3866-4ad9-9f2b-6b57ff90419e?w=100&h=100&q=60" alt="Link In with Us"></div>
</div>
<div class="col-md-6">
<p class="copyright">© 2016 COPYRIGHT LINE</p>
</div>
</div>
</div>
</footer>
CSS:
footer {
padding: 5px;
height: 100px;
width: 100%;
font-size: 14px;
position: absolute;
background-color: #2A3E47;
font-family: 'Contrail One', cursive;
margin: 0px 10px 0px 10px;
text-align:center;
}
.copyright {
padding-top: 40px;
}
footer p {
color: #fff;
}
footer a img {
display: inline-block;
width:50px;
}
.parent .icon {
margin: auto 7px;
}
It looks like your second col-sm-6 is nested too deep. It should be at the same level of the other one, not within it. Your divs are all sitting on half the grid (6 wide) and then the three social logos are taking half of that, and the copyright bit is taking the other half. You need the col-sm-6 divs to be siblings.
Furthermore, I don't think col-sm-6 looks like it'll work, looking at what you're trying to achieve. You might want to make the first group col-sm-3 or so and add an offset class to the copyright part. :-)
There are at least 3 errors in your HTML markup:
<h7>GET SOCIAL WITH US!</h7>
<div class="container'>
The ending quote should be double ("), not single (')
Since you place it in a column, the class name of this tag should be container-fluid, not container
</div>
<div class="row">
<div class="col-sm-6">
Missing close tag, the div .row is not neccessary.
</div>
</div>
</div>
<div class="col-sm-6">
Please see the fixed code here