How to get social media icons on a background image? - html

I am creating a website for a school project. I currently have it up and working but need help with my social media icons to stay on the back ground image. I am using css to size them but I think I am missing something. If someone could please guide me towards the correct code. Thanks
This my code for the social media button
.fa {
padding: 20px;
font-size: 30px;
width: 50px;
text-align: center;
text-decoration: none;
margin: 5px 2px;
}
.fa:hover {
opacity: 0.7;
}
.fa-facebook {
background: #3B5998;
color: white;
}
.fa-twitter {
background: #55ACEE;
color: white;
}
.fa-snapchat-ghost {
background: #fffc00;
color: white;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
.fa-instagram {
background: #125688;
color: white;
}
when I scroll to the end of the page the its white with the social media icons displaying.
Sorry left the html off here is the html
</form>
</div>
</div>
<div style="padding-bottom:16px">
<div Class="module mid">
<h2>Welcome to Uniforms Today.</h2>
<div class="module h1">
<h1>The website that helps parents and kids get their school
uniforms.</h1>
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com
/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</body>
</html>

You can use 2 background attribute on 1 class but as I researched it is a little tricky.
Instead of using 1 colour attribute, you need to use a gradient colour attribute like this following code:
.fa-facebook {
background-image: url('[facebook-icon-link]'), linear-gradient(to right, #3B5998, #3B5998);
background-position: center, center;
background-repeat: no-repeat, no-repeat;
background-size:contain,contain;
}
You can follow the guideline from this link: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds

Related

CSS: Social Icons show a different text color than the one I have set

I have created social icons using w3schools and when pasting the code into my sidebar widget the text within the icons shows black instead of white.
This is my code:
.fa {
padding: 15px;
font-size: 30px;
width: 30px;
text-align: center;
text-decoration: none;
margin: 5px 3px;
border-radius: 50%;
}
.fa:hover {
opacity: 0.7;
}
.fa-facebook {
background: #3B5998;
color: white;
}
.fa-instagram {
background: #E1306C;
color: white;
}
.fa-pinterest {
background: #cb2027;
color: white;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Add font awesome icons -->
Thanks for your help!
You've used hover. Remove this to get same color which you've given in CSS.
.fa:hover {
opacity: 0.7;
}
I've tested your code and it seems to work correctly outside the side-bar.
So the problem might be the side-bar-widget. Do you wrote the widget yourself?
If not, maybe there is a default-style for a-tags in your sidebar that over-writes your color. You could change that, if possible.
Another way would be to increase the specificity of your css, for example by using:
a.fa-facebook {
background: #3B5998;
color: white;
}
If nothing helps, you could try adding an important-statement to your color:
.fa-facebook {
background: #3B5998;
color: white !important;
}
But use !important with care, it is not considered best-pracitce.

CSS, Transparent background of a text

new to HTML and CSS, tried to look for answer but can't seem to find it. Unto the question.
The first code is my style.css the second code is for index.html
h1 {
background-image: url('linkto/images/transparent.png');
background-repeat: repeat;
font-family: "Amarillo";
color: red;
text-align: center;
}
<div id="homeSection" class="sect sectOne"></div>
<h1>Title of Web</h1>
<section class="parallax">
<div id="servicesSection" class="parallax-inner"></div>
</section>
Now, If I had linked a a JPEG filed (instead of PNG), the H1 ("Title of Web") would show as red and the background is the JPEG file, however, I try to put a 50px by 50px transparent image (PNG) it doesn't work and the background just becomes white (default background, my guess).
So I want the text to be red (or whatever color) but the background of it being transparent, am I on the right track or am I doing this all wrong?
A transparent background means it will blend with the background of its container (which I assume in your case is the <body> tag). The default background of the web page is white, so the heading is going to appear on a white background, unless you change the background of the entire web page
Use color to transperant to bg , RGBA color values are an extension of RGB color values with an alpha channel - which specifies the opacity for a color.
An RGBA color value is specified with: rgba(red, green, blue, alpha). The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque).
like you need black transperant background
h1 {
background: rgba(255, 255, 255, 0.2);
color: red;
font-family: "Amarillo";
left: 0;
position: absolute;
right: 0;
text-align: center;
}
search the rgb colors and set opacity what ever you need to the last value
The <h1> tag should not have any background by default. If you see a white background despite of changes, there's something else adding it.
Regardless, you can try to use background: none in your CSS
Edit: Snippet updated based on what you provided. Now works as far as can see, still needs more work on your end.
* {
margin: 0;
padding: 0;
}
#font-face {
font-family: "Amarillo";
src: url('http://kesnielgalvan.atspace.cc/fonts/Amarillo.ttf');
}
h1,
h2,
h3,
h4,
h5,
h6,
p {
margin-bottom: 0px;
}
html,
body {
height: 100%;
}
nav {
position: fixed;
height: 5%;
width: 100%;
z-index: 100%;
text-align: center;
background: rgba(232, 235, 255, 0.09);
padding: 15px;
font-family: fantasy;
box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}
h1 {
font-family: "Amarillo";
color: red;
text-align: center;
}
.h1alt {
background-image: url("http://kesnielgalvan.atspace.cc/images/photo1.jpg");
}
.link {
transition: 0.8s;
color: #ffffff;
font-size: 20px;
text-decoration: none;
padding: 0 10px;
margin: 0 10px;
}
.link:hover {
background-color: #ffffff;
color: #EEA200;
padding: 24px 10px;
}
.sect {
height: 100%;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
}
.subSection {
height: 50%;
background-color: rgb(103, 141, 172);
}
.parallax {
background: url("http://cdn.mysitemyway.com/etc-mysitemyway/webtreats/assets/posts/973/full/tileable-dark-wood-textures-5.jpg") repeat fixed 100%;
}
.parallax-inner {
padding-top: 12%;
padding-bottom: 12%;
}
.sectOne {
background-image: url("http://kesnielgalvan.atspace.cc/images/photo1.jpg");
}
.sectTwo {
background-image: url("http://kesnielgalvan.atspace.cc/images/photo2.jpg");
}
<head>
<meta charset="utf-8" />
<title>Kesniel Galvan</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<nav>
<a class="link" id="home" href="#homeSection">About</a>
<a class="link" id="services" href="#servicesSection">Services</a>
<a class="link" id="gallery" href="#gallerySection">Gallery</a>
<a class="link" id="contact" href="#contactSection">Contact</a>
</nav>
<div id="homeSection" class="sect sectOne"></div>
<h1 class="h1alt">Kesniel Galvan</h1>
<section class="parallax">
<div id="servicesSection" class="parallax-inner"></div>
</section>
<div id="gallerySection" class="sect sectTwo"></div>
<div id="contactSection" class="subSection"></div>
</body>

Styling HTML buttons in Wordpress

In my HTML I have the following:
Knowledge Base
<br />
In my CSS I have the following classes:
.button1 {
display: block;
height: 25px;
width: 130px;
background: #ffffff;
border: 2px solid #000000;
Color: #000000;
text-align: center;
margin-left: auto;
margin-right:auto;
padding-top:10px;
font-weight: 700;
}
The link color is blue, I want to make the link black with white background. I want to change this on hover by making the background black and the link color white.
I can't make it by using the following CSS class:
.button1 a:hover {
background: #393939;
Color: #ffffff;
}
Do I have to change my HTML to be:
<button class="button1" id="save">Sample button</button>
Please advice. I appreciate your support
Is that something like that http://codepen.io/anon/pen/vNMLar ?
a.button1:hover {
background: #000;
Color: #fff;
transition: all 0.2s ease-in-out;
}
it should be
a.button1:hover {
background: #393939;
color: #ffffff;
}
.button1 is already your link. What you did is tell to look for a link inside .button1
EDIT: also the name for the attributes is lower case

Text color not changing on hover

Quick CSS/HTML issue here, please excuse my lack of experience in the field.
I have a download button that I would like to change from having white text to having grey text on hover. Currently the text is white, however despite my defining of a :hover attribute to change the color, it remains white. Here's my code:
HTML:
<a id="postLink" class="button2" href="#">Post</a>
CSS:
.button2 {
display: inline-block;
width:163px;
color: #FFFFFF;
text-align: center;
vertical-align: middle;
padding: 12px 24px;
border: 1px solid #EFEFEF;
border-radius: 8px;
background: #589edb;
font: normal normal normal 20px raleway;
text-decoration: none;
z-index:150;
}
.button2 :hover{
color:#555555;
}
.button2:focus {
border: 1px solid #EFEFEF;
background: #589edb;
background: -webkit-gradient(linear, left top, left bottom, from(#6abeff), to(#6abeff));
background: -moz-linear-gradient(top, #589edb, #589edb);
background: linear-gradient(to bottom, #589edb, #589edb);
text-decoration: none;
}
.button2:active {
background: #589edb;
color:#FFFFFF;
}
#postLink{
color:#FFFFFF;
&:hover{
color:#55555;
}
}
Thanks!
Your .button2 :hover should be .button2:hover the whitespace screws it up ;)
I would remove the
#postLink{
color:#FFFFFF;
&:hover{
color:#55555;
}
}
as it adds nothing and might screw up your code. Are you using LessCSS or SASS? Otherwise, &:hover will not work. Then the #postLink will prioritise over the class and will keep it white.

How to change background colour of entire div on hover?

­I'm making a website and want to have a link inside a div that changes colour when hovered over, however I've come across a problem. Pre hover, I want a border around the div the same colour as the text in the link inside. The background colour should be white. Then, upon hover, I want the background colour to change to the colour of the text and border, and the text to become white. Because I have padding inbetween the link and div border, it doesn't quite work as intended. Here is the source html/css:
HTML:
<div id="home">
HOME
</div>
CSS:
#home {
border: 4px solid #00a651;
font-size: 30px;
padding: 10px 20px 10px 20px;
margin: 20px 100px 20px 100px;
display: inline-block;
}
#home a {
background: #ffffff;
color: #00a651;
text-align: center;
}
#home a:hover {
background: #00a651;
color: #ffffff;
}
When anywhere within the div is hovered over other than the link, nothing happens, and when you hover over the link the padding remains white. What do I need to do to make it so the colour change happens when anywhere on the div is hovered over, and the whole divs colour changes? Thanks, Brandon :)
#home {
font-size: 30px;
margin: 20px 100px 20px 100px;
display: inline-block;
}
#home a {background: #ffffff;
border: 4px solid #00a651;
padding: 10px 20px 10px 20px;
color: #00a651;
text-align: center;
}
#home a:hover {background: #00a651;
color: #ffffff;
}
<div id="home">
HOME
</div>
You need to add the hover event to the div and the anchor:
#home {
border: 4px solid #00a651;
font-size: 30px;
padding: 10px 20px 10px 20px;
margin: 20px 100px 20px 100px;
display: inline-block;
}
#home a {
background: #ffffff;
color: #00a651;
text-align: center;
}
#home:hover {
background: #00a651;
color: #ffffff;
}
#home:hover a {
background: #00a651;
color: #ffffff;
}
<div id="home">
HOME
</div>
I recommend using the jQuery library, if you know how to use it:
Link your jQuery download to your main html file or use a CDN.
In your JavaScript file add a hover event on your link and use the css effect to to change the color of the div once you hover over the link. Then add another css effect so the link changes color as the div does. Like this:
$(document).ready(function(){
$('a').hover(function(){
$('#home').css("background-color","#00a651");
$('a').css("color", "chooseacolor");
});
});
I am not entirely sure what you are asking of, so this is the best answer I can give!
I don't think using :hover on DIV elements is a good idea. As I know, this practice is not fully supported on all browsers of all versions. Why not use some JS?
But, anyway, if you need all area (including padding) in the DIV become clickable - you should rather make it "display:block" in CSS.
$(document).ready(function() {
$('#home').hover(function() {
$(this).css('background-color', '#00a651').find('a').css({
backgroundColor: '#00a651',
color: '#FFFFFF'});
}, function() {
$(this).css('background-color', '#FFFFFF').find('a').css({
backgroundColor: '#ffffff',
color: '#00a651'});
});
});
#home {
border: 4px solid #00a651;
font-size: 30px;
padding: 10px 20px 10px 20px;
margin: 20px 100px 20px 100px;
display: inline-block;
}
#home a {background: #ffffff;
color: #00a651;
text-align: center;
}
/* There is no need to use :hover anymore if using a script */
<!-- this goes to the HEAD section if not arleady there -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<div id="home">
HOME
</div>