I have made some buttons to link people from my site to social media pages and the text in the Google Plus one is too low and I would like it to go higher in the div but I am struggling to do this, my code is here on JS fiddle.
The buttons aren't complete yet, I just want to know how to get the text higher, cheers
.GooglePlus {
color: black;
font-size: 35px;
border-radius: 100px;
padding: 2px;
font-family: Garamond;
font-weight: bold;
height: 40px;
width: 40px;
background-color: #D8D8D8;
text-align: center;
vertical-align: central;
}
a:hover .GooglePlus {
background-color: #FE2E2E;
color: white;
}
Just add line-height:27px; to adjust g+
Code full class:
.GooglePlus {
color: black;
font-size: 35px;
border-radius: 100px;
padding: 2px;
font-family: Garamond;
font-weight: bold;
height: 40px;
width: 40px;
background-color: #D8D8D8;
text-align: center;
vertical-align: middle;
line-height:27px;
}
If i understand you correctly you are just trying to move the text inside of those circle backgrounds higher.
If this is the case you can cheat it with line height as done in this fiddle
http://jsfiddle.net/9dj9u/2/
Which leaves the resulting CSS affected.
.FaceBook {
color: black;
font-size: 35px;
border-radius: 100px;
padding: 2px;
font-family: Calibri;
font-weight: bold;
height: 40px;
width: 40px;
background-color: #D8D8D8;
text-align: center;
line-height:1.1;
}
.GooglePlus {
color: black;
font-size: 35px;
border-radius: 100px;
padding: 2px;
font-family: Garamond;
font-weight: bold;
height: 40px;
width: 40px;
background-color: #D8D8D8;
text-align: center;
vertical-align: middle;
line-height:0.8;
}
Just adjust line-height in percentage values: line-height: 50%, keep increasing or decreasing till you get there, you might also want to adjust padding, and box-sizing... and remove vertical-align
Remember, this isn't quite exact science, because you do not intend the g and the f to stand next to each other like they do in a sentence, watch this: fg, notice how the g normally is indeed lower than the f.
i included the correct vertical-align value and adjusted the height and width
.FaceBook {
color: black;
font-size: 35px;
border-radius: 100px;
padding: 5px;
font-family: Calibri;
font-weight: bold;
height: 40px;
width: 40px;
background-color: #D8D8D8;
text-align: center;
}
a:hover .FaceBook {
background-color: #4c66a4;
color: white;
}
#footer .FaceBook {
display: inline-block;
}
.GooglePlus {
color: black;
font-size: 35px;
border-radius: 100px;*/
border-bottom: 2px solid black;
padding: 2px;
font-family: garamond;
font-weight: bold;
height: 50px;
width: 50px;
background-color: #D8D8D8;
text-align:center ;
vertical-align: text-bottom;
padding: 0px;
}
a:hover .GooglePlus {
background-color: #FE2E2E;
color: white;
}
#footer .GooglePlus {
display: inline-block;
}
#plus {
font-size: 20px;
padding:0px 0px;
}
a {
text-decoration: none;
}
Related
This is basically my header and its a small project but my first time using OOCSS. I know that the principles are to seperate structure and skin to prevent repetetive code. But since my project is so small I have no clue of how i could implement it?
body {
font-family: "Lato", sans-serif;
background-color: white;
}
.wrapper {
max-width: 1024px;
margin: 0 auto;
background-color: #eee;
border: 1px solid black;
}
.header {
height: 350px;
background-image: url(bilder/vietnam_770.jpg);
background-repeat: no-repeat;
background-position: center;
}
.header h1 {
font-family: "Roboto", sans-serif;
font-size: 30px;
font-weight: 700;
float: left;
margin-left: 150px;
margin-top: 10px;
}
.meny ul {
list-style-type: none;
display: flex;
flex-direction: row;
float: right;
margin-right: 170px;
margin-top: 17px;
}
.meny li {
margin-left: 1em;
}
.meny a {
text-decoration: none;
font-size: 14px;
font-weight: 700;
color: black;
padding: 0.25em;
}
.meny a:hover {
color: darkgrey;
}
.meny .current {
border-bottom: 1px solid black;
}
.meny .current:hover {
color: black;
}
.beskrivning {
float: right;
width: 250px;
margin-right: 175px;
margin-top: 80px;
text-align: center;
}
.beskrivning h2 {
font-family: "Lato", sans-serif;
font-size: 24px;
font-weight: 700;
}
.beskrivning p {
margin-top: 0.5em;
font-size: 14px;
font-weight: 700;
line-height: 15px;
}
Tried reading and looking for examples but all examples had repetetive code which made it easy to determine.
I know this sounds like an obvious question and answer, but I have spent a long time trying to figure this out, and for some reason, none of the answers are not working for me. Honestly, this is probably going to be a simple obvious answer I just can't catch. But here's the problem: I am making a website out of HTML5, CSS, and some PHP.
The issue is, that my links appear blue and purple with an underline. I know this is how they are supposed to look, but I have tried many different ways to re-style the links with text-decoration: none, and different colors and so on.
Here is my CSS and the HTML part with a link:
* {
padding: 0;
margin: 0;
}
html, body {
height: 100%;
width: 100%;
}
a {
text-decoration: none;
color: brown;
}
.sidebar {
width: 25%;
height: 100%;
float: left;
background-color: #BC986A;
overflow-y: scroll;
}
.side-option {
width: 100%;
height: 155px;
background-color: #BC986A;
}
.side-option:hover, .side-option:focus {
background-color: #DAAD86;
}
.side-name {
font-family: "Indie Flower", cursive;
font-size: 1.8em;
margin: 2px 2px 0px 7px;
padding: 5px 5px 0px 5px;
}
.side-image {
width: 150px;
height: 97px;
margin: 0px 0px 0px 15px;
border: 0.3em solid #FBEEC1;
}
.info {
background-color: #659DBD;
width: 75%;
height: 100%;
float: right;
}
#name {
font-family: "Gloria Hallelujah", cursive;
font-size: 50px;
text-align: center;
color: #FBEEC1;
}
#s-name {
font-family: "Gloria Hallelujah", cursive;
font-size: 20px;
text-align: center;
color: #FBEEC1;
}
#image {
display: block;
width: 384px;
height: 256px;
margin-left: auto;
margin-right: auto;
border: 0.5em solid #BC986A;
margin-top: 10px;
}
#desc {
font-family: "Rock Salt", cursive;
font-weight: bold;
font-size: 20px;
text-align: center;
color: #DAAD86;
}
<div class="sidebar">
<a href="index.php?page=0"><div class="side-option">
<h2 class="side-name">Brown Bear</h2>
<img src="http://maxpixel.freegreatpicture.com/static/photo/1x/Animal-Brown-Bear-Beast-Bear-Teddy-Bear-Mammal-422682.jpg" class="side-image" alt="Brown bear standing in tall plants.">
</div></a>
I'm not sure if you needed all that, but there it is anyway.
For hover color change you can use this css
.sidebar a:hover{color:red; }
For keep the color focus after click
.sidebar a:focus{color:blue; }
1) You need to change your code from </div></a> at the end to this: </div></a></div>
2)Links can be styled differently depending on what state they are in.:
a:link - a normal, unvisited link
a:visited - a link the user has visited
a:hover - a link when the user mouses over it
a:active - a link the moment it is clicked
You can read more about this in: https://www.w3schools.com/css/css_link.asp
* {
padding: 0;
margin: 0;
}
html, body {
height: 100%;
width: 100%;
}
a, a:link, a:visited{
text-decoration: none;
color: brown;
}
a:hover, a:active{
color: green;
}
.sidebar {
width: 25%;
height: 100%;
float: left;
background-color: #BC986A;
overflow-y: scroll;
}
.side-option {
width: 100%;
height: 155px;
background-color: #BC986A;
}
.side-option:hover, .side-option:focus {
background-color: #DAAD86;
}
.side-name {
font-family: "Indie Flower", cursive;
font-size: 1.8em;
margin: 2px 2px 0px 7px;
padding: 5px 5px 0px 5px;
}
.side-image {
width: 150px;
height: 97px;
margin: 0px 0px 0px 15px;
border: 0.3em solid #FBEEC1;
}
.info {
background-color: #659DBD;
width: 75%;
height: 100%;
float: right;
}
#name {
font-family: "Gloria Hallelujah", cursive;
font-size: 50px;
text-align: center;
color: #FBEEC1;
}
#s-name {
font-family: "Gloria Hallelujah", cursive;
font-size: 20px;
text-align: center;
color: #FBEEC1;
}
#image {
display: block;
width: 384px;
height: 256px;
margin-left: auto;
margin-right: auto;
border: 0.5em solid #BC986A;
margin-top: 10px;
}
#desc {
font-family: "Rock Salt", cursive;
font-weight: bold;
font-size: 20px;
text-align: center;
color: #DAAD86;
}
<div class="sidebar">
<a href="index.php?page=0"><div class="side-option">
<h2 class="side-name">Brown Bear</h2>
<img src="http://maxpixel.freegreatpicture.com/static/photo/1x/Animal-Brown-Bear-Beast-Bear-Teddy-Bear-Mammal-422682.jpg" class="side-image" alt="Brown bear standing in tall plants."/>
</div>
</a>
</div>
a {
text-decoration: none;
color: brown;
}
is where you need to make changes to edit links
to change hover options:
a:hover {
style it here
}
and for already visited links on your site:
a:visited {
style it here
}
You asked how to style links.
a{
color: red;
cursor: wait;
font-size: 24px;
transition: color 0.3s, text-shadow 0.3s;
text-decoration: none;
}
a:hover{
color: green;
text-shadow: 1px 2px 3px #000;
text-decoration: overline;
}
a:active{
font-weight: 900;
}
Working link.
I am having a tiny little problem with the CSS below.
While the boxes all line up, I'm trying to get the text to appear inside the boxes, and then to stylize the text...everything I've tried seems to fail. Something is overriding it or the browser is just ignoring it.
Further still is that the text "Foundation 100 - Presence" always outstrips its intended area. This text is dynamic and will change constantly. So the size of this block will change based on the number of characters in the block. So this value in the CSS -> width:489px; will change accordingly.
Furthermore, each one of those blocks has contain an HTML Form link.
...
A few restrictions no javascript, no java, and no php. straight HTML and CSS.
Anyone want to take a crack at this one ????
The Code on the page:
#video_line {
width: 489px;
text-align: center;
}
#vl_desc {
float: left;
width: 200px;
height: 30px;
background: #ffffff;
}
#vl_rental {
float: left;
width: 62px;
height: 20px;
background: #ff0000;
}
#vl_sales {
display: inline-block;
margin: 0 auto;
width: 62px;
height: 20px;
background: #00ff00;
}
#vl_view {
float: right;
width: 62px;
height: 20px;
background: #0000ff;
}
#vl_text_desc {
text-align: right;
font-size: 19 px;
font-weight: 300;
}
<div id="video_line">
<div id="vl_desc">
<p id="vl_text_desc">Foundation 100 - Presence</p>
</div>
<div id="vl_rental">TEXT</div>
<div id="vl_sales">TEXT</div>
<div id="vl_view">TEXT</div>
</div>
This is what I am looking for ->
Here is a start
#video_line {
width:489px;
text-align:center;
}
#vl_desc {
float:left;
width:250px;
height: 30px;
background: #ffffff;
font-size: 18px;
font-family: arial;
font-weight: bold;
padding: 3px 6px;
}
#vl_rental {
float:left;
width:62px;
height: 20px;
background: #ff0000;
color: white;
font-size: 18px;
font-family: arial;
font-weight: bold;
padding: 3px 6px;
}
#vl_sales {
float:left;
width:62px;
height: 20px;
background: #00ff00;
color: darkgreen;
font-size: 18px;
font-family: arial;
font-weight: bold;
padding: 3px 6px;
}
#vl_view {
float:left;
width:62px;
height: 20px;
background: #0000ff;
color: yellow;
font-size: 18px;
font-family: arial;
font-weight: bold;
padding: 3px 6px;
}
#vl_text_desc {
text-align: right;
font-size: 19 px;
font-weight: 300;
}
<div id="video_line">
<div id="vl_desc"><span id="vl_text_desc">Foundation 100 - Presence</span></div>
<form id="vl_rental">TEXT</form>
<form id="vl_sales">TEXT</form>
<form id="vl_view">TEXT</form>
</div>
Simply change following styles:
#vl_text_desc {
margin-top: 0;
}
#video_line {
width: 489px;
text-align: center;
display: inline;
}
#vl_view {
float: left;
}
#vl_desc {
float: left;
width: 200px;
height: 30px;
background: #ffffff;
margin-right: 16px;
margin-top: 0;
}
From here you can modify font-family and color as you prefer.
I've created a button but I'd like to align it within a container div so it looks like:
My code is:
body {
background-color: black;
}
.buttoncontainer {
background-color: white;
border-radius: 5px;
padding: 5px 5px 5px 5px;
width: 285px;
height: 55px;
}
#button2:hover {
background-color: #feb73b;
}
#button2 {
border: 1px solid black;
border-radius: 7px;
color: #fff;
text-decoration: none;
background-color: #fea710;
display: inline-block;
text-transform: uppercase;
font-size: 20px;
padding: 12px 32px;
font-family: arial;
letter-spacing: .5px;
font-weight: 400;
margin-top: 20px;
}
HTML
<div class="buttoncontainer">
start a free trial
</div>
Link to Fiddle
Any advice?
Apologies for not posting the links as pictures, I do not have enough reputation yet.
Remove margin-top: 20px; from your #button2 CSS
See the fiddle
Thus the CSS would be like
#button2 {
border: 1px solid black;
border-radius: 7px;
color: #fff;
text-decoration: none;
background-color: #fea710;
display: inline-block;
text-transform: uppercase;
font-size: 20px;
padding: 12px 32px;
font-family: arial;
letter-spacing: .5px;
font-weight: 400;
/* margin-top: 20px; */
}
UPDATE
See the updated fiddle
I've changed the padding in the css as padding: 14px 32px;. So it gets centered.
In button2' style :
Remove margin-top
Set display as block
Then :
width:100%;
height:100%;
box-sizing: border-box;
Fiddle : http://jsfiddle.net/by3pe47d/7/
So what I did was swap the id's and class and I added the button 2 class to the html.
I added a position: relative; attribute to the container so the insides would stay inside.
Also if you want to change the position of it like left, right, etc. you can.
I also changed the top margain to 2px instead of 20px
http://jsfiddle.net/by3pe47d/10/
Html-
<div id="buttoncontainer">
<div class="button2">
start a free trial
</div>
</div>
Css-
body {
background-color: black;
}
#buttoncontainer {
position: relative;
background-color: white;
border-radius: 5px;
padding: 5px 5px 5px 5px;
width: 285px;
height: 55px;
}
.button2 {
border: 1px solid black;
border-radius: 7px;
color: #fff;
text-decoration: none;
background-color: #fea710;
display: inline-block;
text-transform: uppercase;
font-size: 20px;
padding: 12px 32px;
font-family: arial;
letter-spacing: .5px;
font-weight: 400;
margin-top: 2px;
}
.button2:hover {
background-color: #feb73b;
}
Large Update
Saw the image that was removed and made a thing that mimics it. It will stay formatted even if you use the left, right, etc. attributes.
http://jsfiddle.net/by3pe47d/11/
So I have a button, but here's the issue. On Firefox only does it not completely fill up. As seen here
This is what it should look like
I'm not really sure what to do. Here's the CSS
.button-panel .button {
-webkit-appearance: none;
border: none;
cursor: pointer;
height: 55px;
font-size: 27px;
letter-spacing: 0.05em;
text-align: center;
width: 100%;
font-family: 'Avenir Next';
display: inline-block;
font-weight: 300;
background-color: #6699FF;
outline: 3px solid #6699FF;
line-height: 59px;
}
And a demo http://jsfiddle.net/h7PXe/
Reason why it showing up is that you use line-height bigger than height of element.
Here you can see how box model is woking and were are outlines:
http://i.stack.imgur.com/Q6J6n.png
You can achieve the same look without using basic properties (then it will work in every browser)
.button-panel .button {
display: inline-block;
padding: 7px 0 5px;
border: 3px solid #6699FF;
width: 100%;
font-family: 'Avenir Next';
font-size: 27px;
font-weight: 300;
letter-spacing: 0.05em;
text-align: center;
background-color: #6699FF;
cursor: pointer;
}
http://jsfiddle.net/h7PXe/1/
Do height: 100%. You need to do this or else the browser won't know what to set the height to.
.button-panel .button {
-webkit-appearance: none;
border: none;
cursor: pointer;
height: 55px;
font-size: 27px;
letter-spacing: 0.05em;
text-align: center;
width: 100%;
font-family: 'Avenir Next';
display: inline-block;
font-weight: 300;
background-color: #6699FF;
outline: 3px solid #6699FF;
line-height: 59px;
height: 100%
}
And a demo.