This is what I'm trying to do, in between the two pink lines is my max width.
This is what I'm getting:
I'm getting close:
This is my HTML:
<footer>
<div class="container">
<div class="row">
<div class="col-sm-6">
<h7>GET SOCIAL WITH US!</h7>
<div class="container'>
<div class="row">
<div class="col-md-2">
<img src="img/FB_LINK.png" alt="Follow us on Facebook"></div>
<div class="col-md-2">
<img src="img/TWITTER_LINK.png" alt="Follow us on Twitter"></div>
<div class="col-md-2">
<img src="img/LINKEDIN_LINK.png" alt="Link In with Us"></div>
</div>
<div class="row">
<div class="col-sm-6"><h7>© 2016 COPYRIGHT LINE</h7></div>
</div>
</div>
</div>
</footer>
This is my CSS for this section:
footer {
height: 60px;
width: 100%;
font-size: 14px;
position: absolute;
background-color: #2A3E47;
font-family: 'Contrail One', cursive;
margin: 0px 10px 0px 10px;
text-align:center;
}
footer.a{
display:inline-block;
margin:0 auto 0 auto;
}
h7{
color:#FFF;
font-size:24px;
font-family: 'Contrail One', cursive;
text-align:center;
}
I can't seem to figure this out, I've drawn it out on a couple sheets of paper, but I can seem to style like like I'd like. Can anyone point out where I'm going wrong?
After trying your the posted code I found that you are using wrong quote pair.
Also the css you gave isn't designed to achieve the goal.
I made a working fiddle here. Check it out
HTML:
<footer>
<div class="container">
<div class="row">
<div class="col-md-6 parent">
<p>GET SOCIAL WITH US!</p>
<div class="icon">
<img src="https://myapnea.org/assets/myapnea/icons/facebook_icon-7eedcb8837293505e1d3b1494ff19c9c3842340d1dfcd193e098e2b44f34456b.png" alt="Follow us on Facebook">
<img src="http://frcgamesense.com/dnn/portals/0/Home/Twitter_icon.png" alt="Follow us on Twitter">
<img src="https://store-images.s-microsoft.com/image/apps.36749.9007199266245564.6701eae8-16d2-4ba0-bdaa-8d9d9f9a1e70.03e5f6a9-3866-4ad9-9f2b-6b57ff90419e?w=100&h=100&q=60" alt="Link In with Us"></div>
</div>
<div class="col-md-6">
<p class="copyright">© 2016 COPYRIGHT LINE</p>
</div>
</div>
</div>
</footer>
CSS:
footer {
padding: 5px;
height: 100px;
width: 100%;
font-size: 14px;
position: absolute;
background-color: #2A3E47;
font-family: 'Contrail One', cursive;
margin: 0px 10px 0px 10px;
text-align:center;
}
.copyright {
padding-top: 40px;
}
footer p {
color: #fff;
}
footer a img {
display: inline-block;
width:50px;
}
.parent .icon {
margin: auto 7px;
}
It looks like your second col-sm-6 is nested too deep. It should be at the same level of the other one, not within it. Your divs are all sitting on half the grid (6 wide) and then the three social logos are taking half of that, and the copyright bit is taking the other half. You need the col-sm-6 divs to be siblings.
Furthermore, I don't think col-sm-6 looks like it'll work, looking at what you're trying to achieve. You might want to make the first group col-sm-3 or so and add an offset class to the copyright part. :-)
There are at least 3 errors in your HTML markup:
<h7>GET SOCIAL WITH US!</h7>
<div class="container'>
The ending quote should be double ("), not single (')
Since you place it in a column, the class name of this tag should be container-fluid, not container
</div>
<div class="row">
<div class="col-sm-6">
Missing close tag, the div .row is not neccessary.
</div>
</div>
</div>
<div class="col-sm-6">
Please see the fixed code here
Related
enter image description here
when screen size is normal
problem
enter image description here
when resizing the screen
I want the text to stay on the right side of the image all the time and never overlap in desktop and mobile
html
I also used bootstrap
<div id="moreNews" class="row">
<div class="col-lg-4 row rowCard">
<div class="col-lg-4">
<img class="imageSize" src="assets\images\image-retro-pcs.jpg" alt="">
</div>
<div class="col-lg-8 moreNewsCol">
<h2 class="moreNewsH2 ">01</h2>
<h3 class="moreNewsH3 ">Reviving Retro PCs</h3>
<p class="moreNewsP ">What happens when old PCs are given modern upgrades?</p>
</div>
</div>
<div class="col-lg-4 row rowCard">
<div class="col-lg-4 moreNewsCol">
<img class="imageSize" src="assets\images\image-top-laptops.jpg" alt="">
</div>
<div class="col-lg-8 moreNewsCol">
<h2 class="moreNewsH2 ">02</h2>
<h3 class="moreNewsH3 ">Top 10 Laptops of 2022</h3>
<p class="moreNewsP ">Our best picks for various needs and budgets.</p>
</div>
</div>
<div class="col-lg-4 row rowCard">
<div class="col-lg-4">
<img class="imageSize" src="assets\images\image-gaming-growth.jpg" alt="">
</div>
<div class="col-lg-8 moreNewsCol">
<h2 class="moreNewsH2">03</h2>
<h3 class="moreNewsH3">The Growth of Gaming</h3>
<p class="moreNewsP ">How the pandemic has sparked fresh opportunities.</p>
</div>
</div>
</div>
and CSS
body {
text-align: center;
margin: 6% 12% 6% 12%;
}
#moreNews {
margin: 0;
margin-top: 5rem;
}
.imageSize {
width: 6rem;
}
.moreNewsH2{
float: right;
text-align: left;
padding-right: 85%;
color: hsl(233 8% 79%);
}
.moreNewsH3{
text-align: left;
color: black;
font-size: 1.2rem;
}
.moreNewsP{
text-align: left;
color: gray;
font-size: 0.9rem;
}
.moreNewsCol{
text-align: left;
}
.rowCard {
margin-right: 0.7rem;
}
.attribution {
margin-top: 6rem;
}
I spend hours messing with code but I didn't got the solution
I want the text to stay on the right side of the image all the time and never overlap in desktop and mobile
I am working on a project and i can't seem to find a way that works to center and make my footer responsive.
This is my html code.
#footer {
position: absolute;
left:0;
bottom: 0;
width: 100%;
height: 2.5rem;
background-color: black;
border-top: 4px solid #F2D380 !important;
}
.socialIcon {//update
width: 20px;
}
<div id="footer">
<div class="col-lg-2 link_list">
Company Information
</div>
<div class="col-lg-2 link_list">
<a href="#" > Privacy Policy and User Agreement </a>
</div>
<div class="col-lg-2 link_list">
About
</div>
<div class="col-lg-2 link_list">
<a href="#" >
©2019 Copyright claim
</a>
</div>
```
<div class="col-sm-6 col-lg-3">//update
<a href="#">
<img src="images/linkedin.png" class=" socialIcon">
</a>
<a href="#" >
<img src="images/instagram.png" class=" socialIcon">
</a>
<a href="#">
<img src="images/facebook.png" class=" socialIcon">
</a>
<a href="#" >
<img src="images/youtube.png" class="socialIcon">
</a>
</div>
</div>
```
I tried some bootstrap classes like justify-content-center but it simply does not work. I know i need to be looking at flexbox but it won't work and i don't know what the problem is.
Thank you in advance for answering.
*Update after i did what i saw in the comments it doesn't work with the socialmedia icons.
I've edited your codes. I explained what I changed in the comment lines. I removed the display table. You don't need this with this codes.
Html :
<div id="footer">
<div class="row text-center"> // I added row here, and I've got all the columns in a row, because all columns must be in a row. I added a "text center" class to keep all the text in the middle.
<div class="col-sm-6 pb-sm-2 col-lg-3"> // that's how I arranged your columns . So they will adjust their width for each width value
Company Information
</div>
<div class="col-sm-6 col-lg-3">
Privacy Policy and User Agreement
</div>
<div class="col-sm-6 pb-sm-2 col-lg-3"> // "pb-sm-2" class to add padding bottom when dimensions are sm
About
</div>
<div class="col-sm-6 col-lg-3">
<a href="#">
©2019 Copyright claim
</a>
</div>
</div>
</div>
Css:
#footer {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
/* height: 2.5rem; */ you can use padding this way instead of specifying height. if you give a single height value, you will need to set height separately for all dimensions.
padding: 20px;
background-color: black;
border-top: 4px solid #F2D380 !important;
}
I hope I could help. Good Luck!
See the code below. You can forget about wrapping each anchor within a "div". It will be a lot easier to simply group them into the parent DIV and then target them. This should work and you can have more flexibility. Also, don't have to worry about flexbox or any external libraries.
<style>
body{
height:2000px; /* for demonstration purposes*/
}
/* position the footer div RELATIVE and give it a "top" property of 100% so it always sits at the bottom regardless of your window height*/
#footer {
position: relative;
top:100%;
width: 100%;
height: 2.5rem;
background-color: black;
border-top: 4px solid #F2D380 !important;
}
/* center all items INSIDE the link_list DIV*/
.link_list{
text-align:center;
}
/* target all the ANCHOR tags as inline elements*/
.link_list a {
margin:50% 20px;
color:white;
text-decoration:none;
text-align: center;
flex: 0 0 16.666667%;
}
</style>
<body>
<div id="footer">
<div class="col-lg-2 link_list">
Company Information
<a href="#" > Privacy Policy and User Agreement </a>
About
<a href="#" >©2019 Copyright claim</a>
</div>
</div>
</body>
Add display:flex; to #footer and it gets a bit of responsiveness.
quick fiddle => https://jsfiddle.net/0b9hoag1/
I'm sorry if I'm not using the correct terminology, I'm new to this. I want to stack two divs side by side horizontally, the image and the message content. I have coded a messaging UI.
It all worked fine until I wanted to ad the users image next to the message. I have tried adding display: inline-block; to both divs (the image and message content) but that didn't help.
I'm not sure what else I can do, unless I just use bootstraps grid system, which seems overkill.
https://codepen.io/anon/pen/pxZygr
clear:both; prevents elements from floating next to one another. Your style rule .message-holder .message-to { clear: both; } is affecting the elements you want to display inline. Here's a helpful readup I found on floats and clear: both.
One way I can think of this working would be to have each value implemented as a table element. Something like...
<table>
<td>
<div class="message-image pull-right">
<img src="http://placehold.it/40x40">
</div>
</td>
<td>
<div class="message-content message-to">
Hey man, how was your day after?
</div>
</td>
</table>
Wherever you have class message-holder, add class d-flex
html,
body {
height: 100%;
}
.messages-wrapper {
padding: 20px 20px 0px 20px;
height: 100vh;
}
.pull-right {
float: right !important;
}
.message-holder .message-to {
float: right;
clear: both;
}
.message-content {
max-width: 300px;
padding: 12px 15px 12px 15px;
border-radius: 3px;
margin-bottom: 10px;
}
.message-image {
clear: both;
}
.message-image img {
width: 40px;
border-radius: 100%;
}
.message-picture img {
width: 20px;
height: 20px;
}
.message-to {
background-color: #161616;
color: #fff;
float: right;
}
.message-from {
background-color: #ebebeb;
float: left;
}
<link rel="stylesheet" type="text/css" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" type="text/css">
<div class="messages-wrapper">
<div class="message-holder d-flex">
<div class="message-image pull-right">
<img src="http://placehold.it/40x40">
</div>
<div class="message-content message-to">
Hey man, how was your day after?
</div>
</div>
<div class="message-holder d-flex">
<div class="message-image pull-right">
<img src="http://placehold.it/40x40">
</div>
<div class="message-content message-to">
Can you also bring your charger when you come round?
</div>
</div>
<div class="message-holder d-flex">
<div class="message-image">
<img src="http://placehold.it/40x40">
</div>
<div class="message-content message-from">
It was alright, I'll tell you all about it later! No problem, I'm on my way now.
</div>
</div>
<div class="message-holder d-flex">
<div class="message-image">
<img src="http://placehold.it/40x40">
</div>
<div class="message-content message-from">
ffff
</div>
</div>
<div class="message-holder d-flex">
<div class="message-image pull-right">
<img src="http://placehold.it/40x40">
</div>
<div class="message-content message-to">
Hey man, how was your day after?
</div>
</div>
</div>
So i have this test site that i am building and i am having a CSS issue that makes no sense as you will see in the jsfiddle i linked below i have a div which makes up the first big box (class p1 and ps) for some reason my text bar (class tagto with the words COMING SOON) has a margin of about 20px on the top and bottom. There is no reference to a margin in my css that should be doing this i have gone through every line maybe a dozen times and just dont get it so i turn to you people who have helped me many times before.
If you can please take a quick look and help me out. It would greatly appreciated.
<body>
<div class="header">
<div class="header-content">
<div class="one"><h1 class="name">Title of Site</h1></div>
<div class="one two"><h5 class="tag">Subtext</h5></div>
</div>
</div>
<div class="codepen"></div>
<div>
<div class="p1 ps">
<img class="img" src="http://placehold.it/300x200" >
<p><h3 class="tagto">COMING SOON</h3></p></div>
<div class="p2 ps">
<p class="c2"><h3 class="tagto">COMING SOON</h3></p></div>
<div class="p3 ps">
<p class="c3"><h3 class="tagto">COMING SOON</h3></p></div>
</div>
</body>
The CSS is in the jsfiddle because the code block here doesnt format it right.
https://jsfiddle.net/kd2q454c/
The margin is from the browser rules. Set:
p, h3 {margin:0;}
in your CSS to override browser based rules.
Fiddle HERE
The margin is present because of the user agent stylesheet's css on h3:
h3 {
display: block;
font-size: 1.17em;
-webkit-margin-before: 1em;
-webkit-margin-after: 1em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
font-weight: bold;
}
To override it, just do:
h3 {
margin: 0;
}
You have to remove the wrapping <p> tags around the <h3> so you have the following code:
<div class="header">
<div class="header-content">
<div class="one"><h1 class="name">Title of Site</h1></div>
<div class="one two"><h5 class="tag">Subtext</h5></div>
</div>
</div>
<div class="codepen"></div>
<div>
<div class="p1 ps">
<img class="img" src="http://placehold.it/300x200" >
<h3 class="tagto">COMING SOON</h3></div>
<div class="p2 ps">
<h3 class="tagto">COMING SOON</h3></div>
<div class="p3 ps">
<h3 class="tagto">COMING SOON</h3></div>
</div>
Then set the .tagto class to margin: 0
.tagto {
text-align: center;
background-color: yellow;
width: 66%;
height: 25%;
line-height: 2.5em;
margin: 0; /* add this line */
}
I all, i've this part of code
HTML:
<div id="services"></div>
<div class="modular-row features small">
<div class="content-inner">
<h1>Für alle Ihre Werte</h1>
<div class="feature-items">
<div class="feature">
<img style="" src="/sdstest/user/pages/01.home/_01.services/icon1.png" />
<div class="feature-content icon-offset">
<h4>Rechenzentrum</h4>
</div>
</div>
<div class="feature">
<img style="" src="/sdstest/user/pages/01.home/_01.services/icon2.png" />
<div class="feature-content icon-offset">
<h4>Kollaboration</h4>
</div>
</div>
<div class="feature">
<img style="" src="/sdstest/user/pages/01.home/_01.services/icon3.png" />
<div class="feature-content icon-offset">
<h4>Archiv</h4>
</div>
</div>
<div class="feature">
<img style="" src="/sdstest/user/pages/01.home/_01.services/icon4.png" />
<div class="feature-content icon-offset">
<h4>Wertsachen</h4>
</div>
</div>
</div>
</div>
CSS:
.feature { margin-right: 2rem; }
What i need is
1: to center the class="feature" elements in the middle
2: have a bit of space between that elements (as is it now).
But this is result:
How can i solve it?
(Demo): https://jsfiddle.net/kf3u042k/
You can change css somthing like this
.modular .features .feature {
display: block;
float: left;
margin-bottom: 1rem;
margin-top: 2rem;
vertical-align: top;
width: 24%;
}
.feature {
margin-right: 15px;
}
Try to add this code into your stylesheet. .feature{
margin-left:auto;
margin-right:auto;
max-width:900px;
}
You have to fix the width and then put your side margin on auto. It would be something like this:
.feature{
max-width:900px;
margin-left:auto;
margin-right:auto;
padding-left: x px;
}
for the space just ad a padding-left on your feature (cf code). Still if your width is not large enough it will go bad