I've made some research here and tried all i can but those icons don't want to be centered. Don't hurt yourself with those  , margin doesn't seems to work..
[class^="icon-"], [class*=" icon-"] {
display: inline-block;
width: 100%;
}
td a {
text-align:center;
}
.fa-phone {
color: #86b545;
}
.fa-map-signs{
color: #86b545;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<table>
<tr>
<td><a class="fa fa-phone fa-3x" href="tel:+33500000000"></a>
<a class="fa fa-map-signs fa-3x" href="https://www.google.com/maps/place/Acttif+Littoral/#47.2957248,-2.2068371,15z/data=!4m2!3m1!1s0x0:0x358670f7109ad0d7?ved=2ahUKEwjMl8zni8rgAhULAWMBHftSDJIQ_BIwCnoECAYQCA"></a> </td>
</tr>
</table>
It's best not to use a table layout for this.
<div class="icon-layout">
<a class="fa fa-phone fa-3x" href="tel:+33500000000"></a>
<a class="fa fa-map-signs fa-3x" href="https://www.google.com/maps/place/Acttif+Littoral/#47.2957248,-2.2068371,15z/data=!4m2!3m1!1s0x0:0x358670f7109ad0d7?ved=2ahUKEwjMl8zni8rgAhULAWMBHftSDJIQ_BIwCnoECAYQCA"></a>
</div>
CSS
.icon-layout {
vertical-align: middle;
// if you want icons centered horizontally
text-align: center
}
.icon-layout a {
display: inline-block;
}
.icon-layout a:last-child {
margin-left: 10px;
}
Give that ago
Reformatting markup for readability & adding a new class center to td
<td class="center">
<a class="fa fa-phone fa-3x" href="tel:+33500000000" />
<a
class="fa fa-map-signs fa-3x"
href="https://www.google.com/maps/place/Acttif+Littoral/#47.2957248,-2.2068371,15z/data=!4m2!3m1!1s0x0:0x358670f7109ad0d7?ved=2ahUKEwjMl8zni8rgAhULAWMBHftSDJIQ_BIwCnoECAYQCA"
/>
</td>
You can then do
.center {
display: flex;
justify-content: center;
}
Related
Having the following code snippet:
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div><p class='mb-2'>This is the title!</p>
<div>
<p><span>5</span> <i class='fa fa-sort-down'></i><span> = this is some text</span></p>
<p><span>24</span> <i class='fa fa-sort-down'></i><span> = this is another text over here</span></p>
<p><span>31</span> <i class='fa fa-sort-down'></i><span> = the same</span></p>
</div>
</div>
As it can be seen in the code, 5 is exactly above 2. It must be above 24, like in the middle, between them.
I've tried to add display flex to the span and then aling-items or aling-self and set it to center but didn't work.
Any suggestions
This is a table layout and you don't need a fixed width:
.table {
display: table;
}
.table p {
display: table-row;
}
.table p span:first-child {
display: table-cell;
text-align: center;
padding: 0 5px;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div><p class='mb-2'>This is the title!</p>
<div class="table">
<p><span>5</span> <i class='fa fa-sort-down'></i><span> = this is some text</span></p>
<p><span>24</span> <i class='fa fa-sort-down'></i><span> = this is another text over here</span></p>
<p><span>31</span> <i class='fa fa-sort-down'></i><span> = the same</span></p>
<p><span>999</span> <i class='fa fa-sort-down'></i><span> = the same</span></p>
</div>
</div>
What about making all spans the same width and then centering the text inside those spans (you'll need to set display: inline-block; to set the span width):
.number{
display: inline-block;
width:18px;
text-align: center;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div><p class='mb-2'>This is the title!</p>
<div>
<p><span class="number">5</span> <i class='fa fa-sort-down'></i><span> = this is some text</span></p>
<p><span class="number">24</span> <i class='fa fa-sort-down'></i><span> = this is another text over here</span></p>
<p><span class="number">31</span> <i class='fa fa-sort-down'></i><span> = the same</span></p>
</div>
</div>
I have a footer at the bottom of my website which contains some fontawesome icons:
I have made the icons hoverable, but how can I make them take me to a website (such as GitHub for the GitHub icon)?
Demo of what I have so far:
* {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
}
.footer {
left: 0;
bottom: 0;
width: 100%;
background-color: #f1f1f1;
color: black;
text-align: center;
padding-top: 25px;
padding-bottom: 25px;
padding-left: 10px;
padding-right: 10px;
}
i:hover {
color: #AEC6CF;
transition: 0.4s;
cursor: pointer;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
<div class='footer'>
<i class="fab fa-github" style='font-size:30px'></i>
<i class="fab fa-stack-overflow" style='font-size:30px'></i>
<i class="fab fa-github" style='font-size:30px'></i>
<br></br>
<p>Copyright © 2021 lunAr-creator - Website Design by me (who else? :D)</p>
</div>
Edit:
If i use <i class="fab fa-github" style='font-size:30px'></i> as suggested, while it works, I now have a icon in a permanent state of active: How can i stop this from happening?
Edit 2:
The solution was to just specify the color for a link. Thanks for the suggestion CBroe.
a:link, i {
color: black;
}
You could use the HTML anchor tag to link to either a URL. Change your HTML to this, it should solve your problem.
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
<div class='footer'>
<i class="fab fa-github" style='font-size:30px'></i>
<i class="fab fa-stack-overflow" style='font-size:30px'></i>
<br></br>
<p>Copyright © 2021 lunAr-creator - Website Design by me (who else? :D)</p>
</div>
You can put font awesome icons in an anchor tag with a href.
<i class="fab fa-github" style='font-size:30px'></i>
i am beginner in html and css and when i was trying to build this web page with it (html and css) ,the images always appears in the middle of the tab and i don't know how to organize it,
stackoverflow keep saying "It looks like your post is mostly code; please add some more details" i have nothing more to say lol , so thank you in advance:)
this my html code:
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <title>HOME</title>
</head>
<body>
<div class="mytabs">
<input type="radio" id="tabfree" name="mytabs" checked="checked">
<label for="tabfree">Free</label>
<div class="tab">
<h2>Free</h2>
<p>Mathematics (from Greek: μάθημα, máthēma, 'knowledge, study, learning') includes the study of such topics as quantity (number theory),[1] structure (algebra),[2] space (geometry),[1] and change (mathematical analysis).[3][4][5] It has no generally accepted definition.[6][7]
Mathematicians seek and use patterns[8][9] to formulate new conjectures; they resolve the truth or falsity of such b
h
.</p>
</div>
<input type="radio" id="tabsilver" name="mytabs">
<label for="tabsilver">Ser</label>
<div class="tab">
<h2>Sr</h2>
<p>jctivity from as far back as written records exist. The research required to solve mathematical problems can take years or even centuries of sustained inquiry.
Rigorous arguments first appeared in Greek mathematics, most notably in Euclid's Elements.[10] Since the pioneering work of Giuseppe Peano (1858–1932), David Hilbert (1862–1943), and others on axiomatic systems in the late 19th century, it has beco.</p>
</div>
<input type="radio" id="tabgold" name="mytabs">
<label for="tabgold">Gd</label>
<div class="tab">
<h2>Gd</h2>
<p>slow pace until the Renaissance, when mathematical innovations interacting with new scientific discoveries led to a rapid increase in the rate of mathematical discovery that has continued to the present day.[11]l
</p>
</div>
<!--
IMAGES
-->
<div class='all-image'>
<div class='single-pic'>
<img src='images/brid2.jpg' >
<div class="image-text">
<h1>bride</h1>
<p>hapyy bride happy life</p>
<p>
<i class="fa fa-facebook"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-youtube"></i>
<i class="fa fa-instagram"></i>
</p>
</div>
</div>
</div>
<div class='all-image'>
<div class='single-pic'>
<img src='images/brid1.jpg' >
<div class="image-text">]
<h1>bride</h1>
<p>hapyy bride happy life2</p>
<p>
<i class="fa fa-facebook"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-youtube"></i>
<i class="fa fa-instagram"></i>
</p>
</div>
</div>
</div>
<div class='all-image'>
<div class='single-pic'>
<img src='images/image.jpg' >
<div class="image-text">]
<h1>bride</h1>
<p>hapyy bride</p>
<p>
<i class="fa fa-facebook"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-youtube"></i>
<i class="fa fa-instagram"></i>
</p>
</div>
</div>
</div>
</body>
</html>
this is my css code:
/*tab*/
.mytabs {
display: flex;
flex-wrap: wrap;
max-width: 600px;
margin: 50px auto;
padding: 25px;
}
.mytabs input[type="radio"] {
display: none;
}
.mytabs label {
padding: 25px;
background: white;
font-weight: lighter;
}
.mytabs .tab {
width: 100%;
padding: 20px;
background: #fff;
order: 1;
display: none;
.mytabs .tab h2 {
font-size: 2em;
}
.mytabs input[type='radio']:checked + label + .tab {
display: block;
}
.mytabs input[type="radio"]:checked + label {
background: #18ffff;
border-radius: 18px;
}
.all-image{
text-align: center;
}
.all-image .single-pic{
display: flex;
padding: 24px;
position: relative;
width: 30%;
height: 30%;
}
thank you in advance :).
Consider deleting
.mytabs .tab {
width: 100%;
padding: 20px;
background: rgb(114, 35, 35);
order: 1;
display: none;
.mytabs .tab h2 {
font-size: 2em;
}
It already looks a whole lot better.
The all-image class have text-align set to center. Since you defined the class in the div element that is the parent element of your img tag, your image will be aligned to the center too.
To avoid your image being centered and I assume you only want your text to be aligned centered, try to set the CSS property text-align: center under the class image-text.
So far I have this:
<div class="w3-sidebar w3-bar-block w3-indigo w3-xxlarge" style="width:70px">
<i class="fa fa-user-circle"></i>
<i class="fa fa-id-card-o"></i>
<i class="fa fa-folder-open"></i>
</div>
If I enter text into the a tag, the text ends up looking jumbled and doesn't go under the button the way I want it to. How can I fix this?
I made a codepen that should match what you are attempting to do :
Here is the css :
.w3-sidebar {
width: auto;
}
.w3-bar-block .w3-bar-item {
/* Overrides default rule */
text-align: center;
}
.sidebar-icon-label {
display: block;
font-size: 10px;
}
You'll see that I removed the inline style of your w3-sidebar, and set it to "auto" instead, which means it will have the size of its content.
I created a new class for your icon labels, and overrode a native w3 rule to center everything.
Update your code Like this
<style>
i{ width:20px;
height:20px;
display:inline-block; }
a{ float:left; width:100%; text-align:center; }
span{ float:left; width:100%; text-align:center; }
</style>
<div class="w3-sidebar w3-bar-block w3-indigo w3-xxlarge"
style="width:70px">
<i class="fa fa-user-circle"></i><span>Text 1</span>
<i class="fa fa-id-card-o"></i><span>Text 1</span>
<i class="fa fa-folder-open"></i><span>Text 1</span>
</div>
I'm a wee bit stuck...
I'm trying to make these 4 icons different colors
<div class="row centered">
<div class="row centered">
<div class="col-lg-8 col-lg-offset-2 w">
<a title="Twitter" href="http://twitter.com/itsjaymem" target="_blank" > <i class="fa fa-twitter fa-4x"></i></i></a>
<a title="JimmyP.co" href="http://jimmyp.co" target="_blank"><i class="fa fa-code fa-4x"></i></a>
<a title="Instagram" href="http://instagram.com/itsjaymem" target="_blank"><i class="fa fa-instagram fa-4x"></i></a>
<a title="Email Me!" href="mailto:jayme#jimmyp.co"><i class="fa fa-envelope fa-4x"></i></a>
</div>
</div>
</div>
Use :nth-child pseudo class like this,
FIDDLE DEMO >>
.w a:nth-child(1)
{
color:#FF0000;
}
.w a:nth-child(2)
{
color:#FF00FF;
}
.w a:nth-child(3)
{
color:#CCCCCC;
}
.w a:nth-child(4)
{
color:#FFFF00;
}
Refer to :nth-child in detail HERE >>
Try this:
.fa-twitter{
background-color:Red;
}
.fa-code{
background-color:Green;
}
.fa-instagram{
background-color:Yellow;
}
.fa-envelope{
background-color:Blue;
}
Note: there is error in your code:
change this
<i class="fa fa-twitter fa-4x"></i></i>
To
<i class="fa fa-twitter fa-4x"></i>
You can either use nth-of-type to target each or you can use element[attr=val] to target those elements uniquely and assign color to them..
If you are going with nth-of-type you can write it as
div.col-lg-8 a:nth-of-type(1) i {
color: #f00;
}
Or if you are going with element[attr=val] selector, you can write it as
div.col-lg-8 a[class*="fa-twitter"] i {
color: #f00;
}
You can also assign the colors straight away to the respective classes, only if you are going to use it on a single element, than you can write it as...
.fa.fa-twitter {
color: #f00;
}
Well one thing that you can try is adding an "id" to those icon tags.
HTML
<a title="Twitter" href="http://twitter.com/itsjaymem" target="_blank" >
<i class="fa fa-twitter fa-4x" id="twitter-icon"></i></i></a>
Then on your CSS you would target that "id" and use background-color.
CSS
#twitter-icon { background-color=blue; }