I have a CSS hover problem - hover isnt working. Can you please check out the code ant tell me whats wrong?
<div class = "prof_line1">
<div class = "prof_image" id = "kristaps_pic">
<img src = "http://pokkers.lv/slakters/hhimages/krissprof.jpg"></img>
<p>Kristaps Slakters - Zvejsalnieks, Frizieris/stilists/kreatīvais direktors</p>
</div>
<div class = "prof_image" id = "alise_pic">
<img src = "http://pokkers.lv/slakters/hhimages/alise.jpg"></img>
<p>Alise Zvejsalniece Slaktere, House of Hair menedžeris</p>
</div>
</div>
<div class = "prof_info" id = "kristaps_info">
<p>Kristaps Slakters Zvejsalnieks Pasaules līmenī godalgots frizieris/ stilists/dizaineris kuram savu imidžu uztic Latvijas, Krievijas un Īrijas slavenības un mākslinieki. Daudz ceļojis un vācis pieredzi dažādās valstīs.</p>
<p><b>Studējis:</b> Rīgas Stila un Modes profesionālajā vidusskolā Baltijas Krievu Institūtā – vides dizainu. Colomer Akadēmijā Dubinā ieguvis Color Specialist Degree, 6 mēnešus pavadījis apmācībā „Tony and Guy” Akadēmijā, 2007- 2009 apguvis Barber profesiju „Hackett's Barber Academy”, 2011 ieguvis „American Crew” Creative Barber diplomu.</p>
<p><b>Apbalvojumi un godalgas:</b></p>
<p> hudge text box
</div>
Here is style and really dont understand why this is not working
.prof_info {
font-size:15px;
border:3px solid black;
width:914px;
margin-top:30px;
margin-left:50%;
transform:translate(-50%);
-webkit-transform:translate(-50%);
display:none;
z-index:1;
}
#kristaps_pic p:hover+#kristaps_info {
display:block;
}
The thing is... the + selector, selects the very below element after the p element. That´s why it´s not working. If you try something like this will work for sure:
#kristaps_pic:hover + #kristaps_info {
display:block;
}
Or if you want to hook the #kristaps_info just if hovering the p you have to alter a bit your markup to the following:
<div class = "prof_line1">
<div class = "prof_image" id = "kristaps_pic">
<img src = "http://pokkers.lv/slakters/hhimages/krissprof.jpg"></img>
<p>Kristaps Slakters - Zvejsalnieks, Frizieris/stilists/kreatīvais direktors</p>
<div class = "prof_image" id = "alise_pic">
<img src = "http://pokkers.lv/slakters/hhimages/alise.jpg"></img>
<p>Alise Zvejsalniece Slaktere, House of Hair menedžeris</p>
</div>
</div>
</div>
CSS worked otherwise.
.prof_info {
font-size: 15px;
border: 3px solid black;
width: 914px;
margin-top: 30px;
margin-left: 50%;
transform: translate(-50%);
-webkit-transform: translate(-50%);
display: none;
z-index: 1;
}
#kristaps_info {
display: none;
}
#kristaps_pic p:hover+#kristaps_info {
display: block;
}
<div class="prof_line1">
<div class="prof_image" id="kristaps_pic">
<img src="http://pokkers.lv/slakters/hhimages/krissprof.jpg">
<p>Kristaps Slakters - Zvejsalnieks, Frizieris/stilists/kreatīvais direktors</p>
<div class="prof_info" id="kristaps_info">
<p>Kristaps Slakters Zvejsalnieks Pasaules līmenī godalgots frizieris/ stilists/dizaineris kuram savu imidžu uztic Latvijas, Krievijas un Īrijas slavenības un mākslinieki. Daudz ceļojis un vācis pieredzi dažādās valstīs.</p>
<p><b>Studējis:</b> Rīgas Stila un Modes profesionālajā vidusskolā Baltijas Krievu Institūtā – vides dizainu. Colomer Akadēmijā Dubinā ieguvis Color Specialist Degree, 6 mēnešus pavadījis apmācībā „Tony and Guy” Akadēmijā, 2007- 2009 apguvis Barber
profesiju „Hackett's Barber Academy”, 2011 ieguvis „American Crew” Creative Barber diplomu.</p>
<p><b>Apbalvojumi un godalgas:</b></p>
<p> hudge text box
</div>
</div>
<div class="prof_image" id="alise_pic">
<img src="http://pokkers.lv/slakters/hhimages/alise.jpg">
<p>Alise Zvejsalniece Slaktere, House of Hair menedžeris</p>
</div>
</div>
Related
I have been trying to rotate a circle with the items inside of it using a button, when I change the rotate value of the circle directly in css it works fine but there appears to be a problem in the html code.
html code:
<html>
<head>
<title>web desgin test</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="main">
<nav>
<div class="logo">
<img
src="C:/Users/USER/Downloads/RealPhone_WebPage_Images/images/logo.png"
alt="">
</div>
<div class="links">
<ul>
<li>Home</li>
<li>Phone</li>
<li>Accessories</li>
<li>Cart</li>
</ul>
</div>
</nav>
<div class="information">
<img
src="C:/Users/USER/Downloads/RealPhone_WebPage_Images/images/mobile.png"
class="mobile">
<div id="circle">
<div class="feature one">
<img
src="C:/Users/USER/Downloads/RealPhone_WebPage_Images/images/camera.png"
alt="">
<div>
<h1>Camera</h1>
<p>108MP Main camera</p>
</div>
</div>
<div class="feature two">
<img src="C:/Users/USER/Downloads/RealPhone_WebPage_Images/images/processor.png" alt="">
<div>
<h1>processor</h1>
<p>Exynos 990</p>
</div>
</div>
<div class="feature three">
<img src="C:/Users/USER/Downloads/RealPhone_WebPage_Images/images/display.png" alt="">
<div>
<h1>Display</h1>
<p>6.9 inch, 1440px</p>
</div>
</div>
<div class="feature four">
<img src="C:/Users/USER/Downloads/RealPhone_WebPage_Images/images/battery.png" alt="">
<div>
<h1>Battery</h1>
<p>4500 mA</p>
</div>
</div>
</div>
</div>
<div class="controls">
<img src="C:/Users/USER/Downloads/RealPhone_WebPage_Images/images/arrow.png" id="upBtn">
<h3>Features</h3>
<img src="C:/Users/USER/Downloads/RealPhone_WebPage_Images/images/arrow.png" id="downBtn">
</div>
</div>
<script>
var circle = document.getElementById('circle');
var upBtn = document.getElementById('upBtn');
var downBtn = document.getElementById('downBtn');
var rotateValue = circle.style.transform();
var rotateSum;
upBtn.onclick = function() {
rotateSum = rotateValue + "rotate(-90deg)";
circle.style.transform = rotateSum;
rotateValue = rotateSum;
}
</script>
css code:
enter code here
#circle {
width: 1000px;
height: 1000px;
position: absolute;
top: 0;
left: 0;
border-radius: 50%;
transform: rotate(0deg);
.controls {
position: absolute;
right: 10%;
top: 50%;`enter code here`
transform: translateY(-50%);
text-align: center;
}
.controls h3 {
margin: 15px 0;
color: #fff;
}
#upBtn {
width: 15px;
cursor: pointer;
}
#downBtn {
width: 15px;
cursor: pointer;
transform: rotate(180deg);
}
................................................................................
Your variable declarations are wrong if for example the id is #circle
document.getElementById(circle); --> document.getElementById('circle');
It is better when you post all html according to this function
There is no circle in your html code...
So when you do this :
var circle = document.getElementById(circle);
var circle is null, because there is not a html element where its id is circle, and you are trying to take one called like that
Also, when you do this:
document.getElementById(circle);
is going to look for a string in every id, so it should be :
document.getElementById('circle');
edit:
for been clear, when you use selector, you are looking for a matching string, when you do this:
var circle = document.getElementById(circle);
var upBtn = document.getElementById(upBtn);
var downBtn = document.getElementById(downBtn);
It should be this:
var circle = document.getElementById('circle');
var upBtn = document.getElementById('upBtn');
var downBtn = document.getElementById('downBtn');
In the firt one you are sayin look for a string with the value os circle
var circle = 'notCircle'
var circle = document.getElementById(circle);
console.log(circle)
In the second you are looking direclty for x string on html ids
I am working on a HTLM editor who combine HTML & CSS in the same page. I want that the users have a zoom when mouseover on a picture in front page
<h4><img style="border: 1px solid black; align: right;" title="" src="sys_attachment.do?sys_id=00ee33cbdb1b9c507261e03cd396190b" alt="" width="204" align="right" border="1" hspace="" vspace="" /></h4>
<h4><strong>4. Entrez votre mot de passe.</strong></h4>
<ul style="list-style-type: disc; list-style-position: inside;">
<li>Puis, cliquez sur "Suivant".</li>
</ul>
I searched for solution but the solution is always when HTML and CSS are separated
If someone has any advice or solution, please help me !
Sorry for my english, i am still learning !
Here a full example working with css :hover. No need JS.
You need to set the style element into your head element out of body element
<html>
<head>
<style>
.zoom {
transition: transform .2s; /* Animation */
}
.zoom:hover {
transform: scale(1.5); /* (150% zoom - Note: if the zoom is too large, it will go outside of the viewport) */
position:absolute;
right:0;
}
</style>
</head>
<body>
<p> </p>
<hr />
<h4 class="zoom"><img style="border: 1px solid black; align: right;" title="" src="https://cdn.pixabay.com/photo/2020/09/09/13/03/bike-riding-5557589_1280.png" alt="" width="204" align="right" border="1" hspace="" vspace="" /></h4>
<h4><strong>4. Entrez votre mot de passe.</strong></h4>
<ul style="list-style-type: disc; list-style-position: inside;">
<li>Puis, cliquez sur "Suivant".</li>
</ul>
<p> </p>
</body>
</html>
Here is a solution with JS Adapt from answer here : Javascript: Zoom in on mouseover WITHOUT Jquery or plugins
<html>
<head>
<style>
</style>
</head>
<body>
<p> </p>
<hr />
<h4>
<img id="imgZoom" style="border: 1px solid black; align: right;" width="200px" height="200px" align="right" onmousemove="zoomIn(event)" onmouseout="zoomOut()" src="https://cdn.pixabay.com/photo/2020/09/09/13/03/bike-riding-5557589_1280.png">
<div style="border: 1px solid black;
width: 200px;
height: 200px;
display: none;
background-image: url('https://cdn.pixabay.com/photo/2020/09/09/13/03/bike-riding-5557589_1280.png');
background-repeat: no-repeat;"
id="overlay"
onmousemove="zoomIn(event)"></div>
</h4>
<h4><strong>4. Entrez votre mot de passe.</strong></h4>
<ul style="list-style-type: disc; list-style-position: inside;">
<li>Puis, cliquez sur "Suivant".</li>
</ul>
<p> </p>
<script>
function zoomIn(event) {
var element = document.getElementById("overlay");
element.style.display = "inline-block";
var img = document.getElementById("imgZoom");
var posX = event.offsetX ? (event.offsetX) : event.pageX - img.offsetLeft;
var posY = event.offsetY ? (event.offsetY) : event.pageY - img.offsetTop;
element.style.backgroundPosition = (-posX * 4) + "px " + (-posY * 4) + "px";
}
function zoomOut() {
var element = document.getElementById("overlay");
element.style.display = "none";
}
</script>
</body>
</html>
Last example with style directly in body:
It is accepted normaly based https://www.w3.org/Submission/1996/1/WD-jsss-960822
<html>
<body>
<style>
.zoom {
transition: transform .2s; /* Animation */
}
.zoom:hover {
transform: scale(1.5); /* (150% zoom - Note: if the zoom is too large, it will go outside of the viewport) */
position:absolute;
right:0;
}
</style>
<p> </p>
<hr />
<h4 class="zoom"><img style="border: 1px solid black; align: right;" title="" src="https://cdn.pixabay.com/photo/2020/09/09/13/03/bike-riding-5557589_1280.png" alt="" width="204" align="right" border="1" hspace="" vspace="" /></h4>
<h4><strong>4. Entrez votre mot de passe.</strong></h4>
<ul style="list-style-type: disc; list-style-position: inside;">
<li>Puis, cliquez sur "Suivant".</li>
</ul>
<p> </p>
</body>
</html>
I am trying to recreate this team/leadership page:
I have put a box shadow around my ul element, as the example above does. I can't get the margins around the li elements the same way - I set the right margins to be 5 px, but it still bordered with white. How do I get the margins (or space between li elements) to just be filled with the background color of the div (or the ul in this case)?
JSFiddle here: http://jsfiddle.net/mzechar/gyo6t25e/10/
HTML:
<section class = "content-wrapper team">
<h3>Columbia</h3>
<div class = "team-listing">
<ul>
<li>
<div class = "team-member-listing-wrapper">
<div class = "circle-image-crop">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
</div>
Jane Jam
<br>
<span class = "bio">lead the design and development of early tablet PC, UMPC, and mobile phone prototypes and helped with the initial design of the current iPhone app.</span>
</div>
</li>
<li>
<div class = "team-member-listing-wrapper">
<div class = "circle-image-crop">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
</div>
Jane Jam
<br>
<span class = "bio">lead the design and development of early tablet PC, UMPC, and mobile phone prototypes and helped with the initial design of the current iPhone app.</span>
</div>
</li>
<li>
<div class = "team-member-listing-wrapper">
<div class = "circle-image-crop">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
</div>
Jane Jam
<br>
<span class = "bio">lead the design and development of early tablet PC, UMPC, and mobile phone prototypes and helped with the initial design of the current iPhone app.</span>
</div>
</li>
<li>
<div class = "team-member-listing-wrapper">
<div class = "circle-image-crop">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
</div>
Jane Jam
<br>
<span class = "bio">lead the design and development of early tablet PC, UMPC, and mobile phone prototypes and helped with the initial design of the current iPhone app.</span>
</div>
</li>
<li>
<div class = "team-member-listing-wrapper">
<div class = "circle-image-crop">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
</div>
Jane Jam
<br>
<span class = "bio">lead the design and development of early tablet PC, UMPC, and mobile phone prototypes and helped with the initial design of the current iPhone app.</span>
</div>
</li>
<li>
<div class = "team-member-listing-wrapper">
<div class = "circle-image-crop">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
</div>
Jane Jam
<br>
<span class = "bio">lead the design and development of early tablet PC, UMPC, and mobile phone prototypes and helped with the initial design of the current iPhone app.</span>
</div>
</li>
<li>
<div class = "team-member-listing-wrapper">
<div class = "circle-image-crop">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
</div>
Jane Jam
<br>
<span class = "bio">lead the design and development of early tablet PC, UMPC, and mobile phone prototypes and helped with the initial design of the current iPhone app.</span>
</div>
</li>
<li>
<div class = "team-member-listing-wrapper">
<div class = "circle-image-crop">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
</div>
Jane Jam
<br>
<span class = "bio">lead the design and development of early tablet PC, UMPC, and mobile phone prototypes and helped with the initial design of the current iPhone app.</span>
</div>
</li>
<li>
<div class = "team-member-listing-wrapper">
<div class = "circle-image-crop">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
</div>
Jane Jam
<br>
<span class = "bio">lead the design and development of early tablet PC, UMPC, and mobile phone prototypes and helped with the initial design of the current iPhone app.</span>
</div>
</li>
<li>
<div class = "team-member-listing-wrapper">
<div class = "circle-image-crop">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
</div>
Jane Jam
<br>
<span class = "bio">lead the design and development of early tablet PC, UMPC, and mobile phone prototypes and helped with the initial design of the current iPhone app.</span>
</div>
</li>
<li>
<div class = "team-member-listing-wrapper">
<img class = "team-member-photo" src="BW.jpg" onmouseover="this.src='COLOR.jpg'" onmouseout="this.src='BW.jpg'"">
<span class = "team-member-name">Jane Jam</span>
</div>
</li>
</ul>
</div>
</section>
CSS:
section.team{
margin: auto;
overflow: hidden;
background: #FEFEFE;
display:inline-block;
}
.team-listing{
position:relative;
margin-top:40px;
margin-right:auto;
margin-left:auto;
}
.team-listing li{
display:inline-block;
width: 30%;
overflow: hidden;
float:left;
height: 320px;
list-style-position:inside;
margin-right:5px;
background-color:#FEFEFE;
}
.bio{
display: inline-block;
text-align:left;
color: #111;
font-size: 1rem;
line-height: 1;
visibility:hidden;
}
.team-member-listing-wrapper{
text-align: center;
vertical-align: top;
width:100%;
height:100%;
margin: 0 auto;
display:inline-block;
}
.team-member-listing-wrapper strong{
font-size: 1.125rem;
line-height: 1;
}
.team-listing ul{
display:table;
list-style: none;
box-shadow:0 0.9375rem 3.75rem rgba(2,2,22,0.1);
white-space: nowrap;
width:80%;
margin:auto;
}
.circle-image-crop{
width: 180px;
height: 180px;
position: relative;
overflow: hidden;
border-radius: 50%;
margin-left:auto;
margin-right:auto;
margin-top:20px;
}
.circle-image-crop:hover{
height:100%;
width:auto;
border-radius:0%;
}
.circle-image-crop img{
display: inline;
margin: 0 auto;
height: 100%;
width: auto;
}
You would have to use filter: drop-shadow(5px 5px 5px #222); in this case as the shadow for the <ul>.
Box-shadow is only around the div, and doesn't fill the inside of it.
Box-shadow vs Drop shadow
I have the issue where I cant adjust the distance between an image and a text.
CSS:
.medarbetare-img {
width: 180px;
height: 100px;
margin-bottom: -25px;
margin-top: 28px;
}
CODE:
<div class="left">
<div class="medarbetare-img" style="background:url(http://byggprojektoren.se/wp-content/uploads/2014/09/Rinor2.jpg) center top no-repeat;"></div>
</div>
<div class="right">
<br>
<p style="font-size:12px;">RM
<br>Konstruktör, VD,delägare
<br> <a style="font-size:12px;" href="mailto:#byggprojektoren.se">#byggprojektoren.se</a>
<br>0762 - 62 23 567</p>
</div>
<p style="text-align:justify; font-size:12px; padding:10px 0;">Utbildad civilingenjör inom konstruktionsteknik. Under min studietid har jag arbetat som arbetsledare under tre somrar samt jobbat inom VDC på entreprenadföretaget NCC </p>
I tried adjusting the margin-bottom: -25px- but nothing happends, only on the mobile site. Does anyone have an idea why distance wont get smaller?
URL: http://byggprojektoren.se/om-byggprojektoren/
Try giving to the .left class the margin-bottom attribute.
.left {
margin-bottom: -28px;
}
Because the div with the class: medarbatare-img is in another div with the class of left.
I have the following code.
<html>
<head>
<style>
.fb{
position: relative;
right:-1000px;
}
.info{
position:relative;
}
</style>
</head>
<body>
<div id="info">
About Us |
Privacy Policy
<a id = "fb" href="https://www.facebook.com/xyz" target="https://www.facebook.com/xyz"> <img src="../images/facebook.png" height = 16, width = 16 /> </a>
</div>
</body>
</html>
I want to move the fb link to the right corner. I guess my styling is not working. Or am I going wrong somewhere?
You have defined a class in your stylesheet
.fb{
position: relative;
right:-1000px;
}
.info{
position:relative;
}
so while using it you should do
<div class="info">
...
</div>
<div class="fb">
...
</div>
OR if you want to use id then
#fb{
position: relative;
right:-1000px;
}
#info{
position:relative;
}
<div id="info">
...
</div>
<div id="fb">
...
</div>
first don't use spaces in attr="smth". Also you use id not class so css selector should be #fb , not .fb
Use this #fb{
float:right;
}
You are using class (.class) selectors instead of id (#id) selectors in your css
The styles are not reflecting because you are using . instead of #. . is used while dealing with class, for id use #.
Try this:
#fb{
position: fixed;
right:10px;
}
#info{
position:relative;
}
Jsfiddle
<div id="info">
About Us |
Privacy Policy
<a id ="fb" href="https://www.facebook.com/xyz" target="https://www.facebook.com/xyz">
<img src="../images/facebook.png" height = 16, width = 16 alt="FB"/> </a>
</div>
CSS
#fb
{
float:right;
}
.info
{
position:relative;
}
There were no class named fb. DEMO