Hovering over one of two identical divs will trigger an effect

Having a bit of trouble with CSS hover... I have two divs in the same class and I need to specify hover effects for only one of them. I've tried some solutions but they either don't work or change colors on both.

<div class="container iphone">
    <!-- First box -->
    <div class="span3 iphone-box-left">
  ======> <div class="quoteLeft"> <====== :hover
            <blockquote>
                <p>
                   description here
                </p>
            </blockquote>
            <p class="credit">
               johny 
            </p>
        </div>
    </div>
    <!-- First box end -->
    <!-- Second box -->
    <div class="span6">
        <img src="images/iphone.png">
        <!-- Start Logo -->
        <div class="logo-second">
            <h3>
         ==============================================================
         When hovering over quoteLeft, I want to change the color of this icon present in logo

         ====> <i class="icon-cloud icon-large"></i> <=================
                creative
            </h3>
        </div>
        <!-- Logo end -->
    </div>
    <!-- Second box end -->  

CSS

.iphone {
    position: relative; margin:50px auto; background:url(../images/11.png);
}


.quoteLeft {
    position:relative;
    top:40px;
    padding:15px 25px 20px;
    margin:20px auto;
    font:italic 26px/1.4 Georgia, serif;
    color:#fff;
    background:rgba(34, 34, 34, .5);
}

.quoteLeft:after {
    content:"";
    position:absolute;
    top:100%;
    left:100%;
    margin-top:-4px;
    background:url(../images/box-line.png) no-repeat;
    width:150px; height:165px;

}
.quoteRight {
    position:relative;
    top:150px;
    padding:15px 25px 20px;
    margin:20px auto;
    font:italic 26px/1.4 Georgia, serif;
    color:#fff;
    background:rgba(34, 34, 34, .5);
}

.quoteRight:after {
    content:"";
    position:absolute;
    top:100%;
    right:80%;
    margin-top:-4px;
    background:url(../images/box-line-2.png) no-repeat;
    width:300px; height:165px;

}
.credit {
    margin:1em 0 0;
    font:14px/1.2 Arial, sans-serif;
}

.credit:before {
    content:"— ";
}

blockquote, p {padding:0; margin:0;}


.logo-second { position:absolute; margin-top:-20%; margin-left:11%;}
.logo-second h3 { font-size:56px;}


.quoteLeft:hover  {And....}

I'm open to any CSS or jQuery suggestions. Thanks!

Answer №1

Here is the solution to your problem:

HTML

<div class="container">
    <div class="item1">Item 1</div>
    <div class="item2">Item 2</div>
</div>

CSS

.container .item1:hover ~ .item2 {
    background-color: #f00;
}

I have created a JSFiddle for you to view.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for modifying the 'margin-left' CSS attribute to an integer value on a property that currently holds a string value like 'color' using jQuery or JavaScript

I am looking to change the border color to green or any other color. I have already set the border color, but now I want to fill it with a color by using a method similar to the 'Paint Bucket' tool in Photoshop. $(document).ready(function () { ...

Ensure that jquery.load is executed before the HTML content is loaded

Recently, I encountered a situation where I had a bootstrap navbar stored in a separate file, specifically named navbar.html. I utilized Jquery.load() to load this navbar into my HTML page. At the bottom of my HTML page, I included the following code: &l ...

How to customize the font size in three.js CSS3DRenderer

I am trying to use threejs's CSS3DRenderer to display text in my 3D view. However, I am facing issues with controlling the font size. Despite setting font-size: 1px in CSS, the text remains large. I also attempted to adjust the scale of the css3dobjec ...

What is the method for defining CSS styles for child elements using the parent element's style attribute?

Here is an example: <div style="SET IMAGE ATTRIBUTES HERE!"> <img src="http://somesite.com/someimg.jpg"><br /> <img src="http://someothersite.com/someotherimg.jpg"><br /> ... </div> With my dynamic ASP.NET ...

Codeigniter experiencing issues with loading CSS file

Currently, I am utilizing codeigniter for a specific project of mine. However, I have encountered an issue related to CSS. The problem seems to be with the loading of CSS files as I keep receiving a 404 error when trying to load them. Surprisingly, all oth ...

The class "pagination pagination-lg" from the link https://angular-ui.github.io/bootstrap/#/pagination seems to be malfunctioning in Bootstrap 4

Just starting out with angularjs and I'm trying to implement pagination using https://angular-ui.github.io/bootstrap/#/pagination. However, I'm facing an issue where the style class "pagination pagination-lg" is not applying properly. I'm cu ...

I'm looking to create a JavaScript function that will extract each element from a div and then apply a corresponding CSS block to activate it

My goal was to create this function using Flask, but it seems that only JavaScript is capable of achieving it. This is my first attempt at coding it. Here's the code snippet: const navSlide2 = () => { const burger = document.querySelector(&apos ...

What is the method for utilizing the variable from express in HTML?

Currently, I am working with Express and have the following code: app.get('/', requiresAuth(), (req, res) => res.sendFile('/db_auth_site/index.html', { title: 'Hey', message: 'Hello there!' }) ); I am trying ...

Blend divs that have a width specified in percentages with a margin measured in pixels

My challenge is creating a page layout where multiple items each have a 33.33% width to fill the entire page, with a desired 20px margin between them. However, adding this margin only on the right of every 1st and 2nd item in a row causes layout issues. Yo ...

I am experiencing issues with the required tag on my email input in the form. Despite using the built-in HTML5 required function, it seems to be malfunctioning. Any suggestions on how to resolve this?

Currently tackling one of the 5 projects in my freecodecamp Responsive Web Design course (the survey project) and facing an issue with utilizing the built-in required function in HTML5 for my email input field. Despite my best efforts, upon hitting enter, ...

Notifying the chosen option using jQuery

I have been attempting to display an alert on the webpage based on the selected option. Unfortunately, it appears that my code is not functioning properly. This is what I have tried: $(document).ready(function(){ $("select.country").change(functio ...

What is the best way to center an image on a mobile-responsive website?

How can I center an image on mobile devices using responsive design? Here is the code from my index.html file: <div class="iteams"> <div class="width8 os-animation" data-os-animation="slideInRight" data-os-animation-delay="1.5s"><h2> ...

Long X-axis labels on D3 chart causing overlap issue

I am facing an issue with my D3 Bar chart where the X-Axis labels are overlapping. Here is the code snippet that I have: // implementing word wrapping for x axis svg.append("g") .attr("class", "x axis") .attr("transform", "translate(0," + height ...

Obtaining every PDF file linked within a designated div/table section of a website

Is there a way to download all PDFs linked in a table on a webpage using javascript? Edit: To clarify, I am trying to find a solution where Javascript can automatically download all the PDFs contained within a specific table on a webpage viewed in a brow ...

Incorporating an external script within a Next.js application

I've been having trouble incorporating an external JavaScript source into my Next.js application and I keep encountering the following error: Failed to execute 'write' on 'Document': It isn't possible to write into a documen ...

The second tab on Bootstrap5's tab content feature seems to generate an endless amount of white

I am working on a project where I need to display statistics for both the current month and year. To organize this data, I created a card with tabs for each - one tab for the month and another for the year. By default, the month tab is loaded first. Howev ...

Video streaming platform without the need for javascript and plugins

Is it feasible to watch Youtube videos without relying on javascript and plugins, exclusively using HTML5 or a similar alternative? ...

Conceal the PayPal Button

Currently, I'm facing a challenge where I need to dynamically show or hide a PayPal button based on the status of my switch. The issue is that once the PayPal button is displayed, it remains visible even if the switch is toggled back to credit card pa ...

How can I correctly link and open a PDF file in HTML without an extension provided in the filename?

Looking for some advice. I have a client project where there are PDF files uploaded to a file structure within a LAMP Stack, but the files do not have extensions. I need the browsers to recognize that these files are PDFs and open them accordingly. Adding ...

What causes the presence of a boundary around the svg?

I have been encountering an issue while attempting to incorporate my logo into the header of my webpage. Specifically, when viewed on smaller screens, I noticed that there is a margin surrounding the SVG image. Below is my HTML file: <html lang="e ...