Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I want to be able to create a button which, when hovered over, changes the background colour of my website.
I have no idea how to attempt this and am looking for any help people can give.
You can see the effect I am trying to replicate on the desktop version of the nowthisnews.com website when you hover over the social icons.
Thanks
You can do it this way
function bgChange(x) {
document.body.style.background = x;
}
ul li{
color:#fff;
list-style-type:none;
padding:2px;
margin:7px;
}
ul li a{
color:#fff;
padding:5px;
}
<ul>
<li>Red</li>
<li>Green</li>
<li>Blue</li>
<li><a href="" onmouseover="bgChange(this.style.backgroundColor)"
style="background:yellow;">yellow</a></li>
</ul>
You can do this with jquery
$(document).ready(function () {
$('.column-1').mouseover(function() {
$('.mask-1').css("background-color", "#061981");
......
});
}
essentially a mouseover(function ... on the area you want observ .. perform a changing on css backgrond-color related the proper div (in this case the div class mask-1)
you can easly inspect the code using firebugs on inspecting code provided by the browser
You can simply use jquery to style the background css. just make sure the jquery file is included on the page and modify the code below with your element id's
$('#button-name').hover(function(){
$('#background-name').css('background-color':'red');
});
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
TLDR: Please help me remove the underline of the text in the navigation.
Context:
I am making a Mobile news application.
Problem:
I want to remove underlines on the text of the navigation.(Home, login)
<h1>ignore this code </h1>
https://jsfiddle.net/uatmt99g/
Look specifically at the nav div and everything inside.
Similar post I have found whilst researching the issue (click link):
Remove line under image in link
I have tried the following but may have not implemented it correctly:
using CSS to remove text decoration,
using CSS to remove styling of text,
Any help?
Thanks in advance
you are using link () tags. to remove those "underlines" simply use the css below
a {
text-decoration: none;
}
The text with the underlines are links, so they have basic styling that goes with a link, including a line under the text. In order to remove it, you must specify text-decoration: none; to your a.
https://jsfiddle.net/uatmt99g/1/
Add this after nav in the CSS.
nav a{text-decoration: none;}
Links acquire their own properties . you must declare with the #mynewpattern a{} format
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
so I'm trying to get my nav bar to basically, look nicer, I've designed it mostly how I want it in CSS, but each link is the size according to it's word size, so each block/link is sized differently (hope that makes sense) so I'm wanting to make them all the same size not/not dependent on word length. I'm also wanting to change the color behind the links (basically make it so the color stretches to the sides) I included a link to a picture explaining what I'm talking about: http://postimg.org/image/mdoq7vwy7/ . Thanks in advance!
You'll want to use flexbox. Flexbox can make all the item the same size regardless of the content.
JSFiddle
ul{
display:-webkit-box;
display:-webkit-flex;
display:-ms-flexbox;
display:flex;
list-style-type:none;
}
ul li{
-webkit-box-flex:1;
-webkit-flex:1;
-ms-flex:1;
flex:1;
text-align:center;
}
PS. It's hard to give you help without you providing any code
To make each link in the navbar the same width, give them all the same class and do this css:
.list-class { width: 100px; }
And to make the color stretch past the margins, I would try this:
li { padding-left: 5px; padding-right: 5px }
Assuming you are using lists for your navbar. It's a little hard to help without the code but hopefully this helped
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
What is this? Button or Select ? How do like this by HTML and CSS ? Thank
This is most probably a styled select element. Take a look at this tutorial http://css-tricks.com/dropdown-default-styling/
This can be a simple div with 3 elements in it.
1) The image - with the top and the bottom arrow.
2) The ul tag - when clicked on the image, the ul's get displayed.
3) The label - when any of the li's is selected, its value is copied to the label
you can do thing like this with simple div. something like that
<div id="button"><span>Location</span></div>
#button
{
width: 100px;
height: 40px;
background-color: grey;
border-radius:15px;
position:relative;
}
#button>span
{
position:absolute;
top:10px;
left: 10px;
}
I actually made a plugin that lets you do this here is a link; just download the files include the script and css run
$('document').ready(function(){
$('select').niceselect();
})
and you can then style it however you want using css.
http://projects.authenticstyle.co.uk/niceselect/
This is a Select element.
Check this Example : dropdown list
advice how to solve that kind of problems
IF you are using Chrome,Firefox... you can right click on any element on page then inspect element
and see HTML CSS even JS for that element
Read more about Chrome Developer tools
https://developers.google.com/chrome-developer-tools/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have an image inside a link like this:
<img src="img/post.png">
all I want is the image to change to "post_light.png" when user places mouse hover link. Any idea which is the easier way to do this?
Pure HTML
<img src="img/post.png" onmouseover="this.src='img/post_light.png'" onmouseout="this.src='img/post.png'">
You have already asked this. Please do not ask twice, instead edit your first question if needed.
With only HTML and CSS, it is not posible to change the source of image. If you change the IMG tag to a DIV tag, then you can change the image that is set as the background.
div {
background: url('http://www.placehold.it/100x100/fff');
}
div:hover {
background: url('http://www.placehold.it/100x100/000001');
}
Be aware of the possible SEO and screen reader complications that can arise from this.
You can do something like this:
<a class="switch-image" href="start_post_job.php">
<img class="main-img" src="img/post.png">
<img class="caption-img" src="img/post-light.png">
</a>
The styling:
.main-img{
z-index; // This might not be required
}
.caption-img{
z-index:10;
display:none;
}
.swith-image:hover > .caption-img{
display:inline-block; // either this or block
}
.swith-image:hover > .main-img{
display:none;
}
This should switch the images. Just you play around with it, I think you should beable to do this just by changing the display property of the two or just by changing the z-index.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
while making navigation tab in the anchor tag i used the text-decoration:none; command in the css file but the under line and color change still appears for me.Is there any way to remove the under line and color changing
Just by what you said I will take a guess where you went wrong.
#text-decoration:none; is not vaild due to the # in front, you use it in CSS.
Within the style of a div:
<div class="test" style="text-decoration:none;">Test</div>
Now within style tags:
.test {
text-decoration:none;
}
I'm sure from this you will be able to work out how to do what you want with it.
click here working demo
css
.lorem a{
text-decoration:none;
color:red;
}
html
<div class="lorem">
lorem ipsum
</div>
Style like this.
ul > li > a {
text-decoration:none
}
And it will work 100% unless u have nestede the A really wirede.
If you would share your actual CSS it would be easy to help you, but for now we have to guess...
Try to remove the hashtag before removing the decoration:
linkElement
{
text-decoration:none;
}
If you select the element by class, use
.linkElement
{
text-decoration:none;
}
If you select the element by ID, use
#linkElement
{
text-decoration:none;
}
Make sure you do this one the actual element carrying the underline. If the A (hyperlink) has underline, dont select the LI covering it:
Wrong example:
<ul>
<li>
underlined words
</li>
</ul>
ul li
{
text-decoration:none;
}
Right example:
<ul>
<li>
underlined words
</li>
</ul>
ul li a
{
text-decoration:none;
}