I'm having a little trouble with floating my elements. I have some phantom margin that has appeared on my 3rd col element; as seen in the image below;
I have tried adding; box-sizing: border-box; but this doesn't help either. Is there something I am missing?
Code
#f-wrap {
position: relative;
width:100%;
margin: 0 auto;
}
.row {
display: inline-block;
width: 100%;
}
.col {
display: inline-block;
float: left;
width: 45%;
margin: 2em 1em;
background: #f0f;
}
<section class="ctre s-f">
<div id="t-wrap">
<div class="row">
<div class="col">
<img src="img-bin/mgi-logo.png" alt="MGI Technology logo." width="20%"/>
</div>
<div class="col">
<h3 class="f-h">Related Links</h3><br/>
<ul>
<li class="f-lnk">Home</li>
<li class="f-lnk">About us</li>
<li class="f-lnk">Products</li>
<li class="f-lnk">News</li>
<li class="f-lnk">Contact us</li>
<li class="f-lnk">Recycle</li>
<li class="f-lnk">Site map</li>
</ul>
</div>
</div>
<hr class="style-two"/>
<div class="row">
<div class="col">
<h3 class="f-h">Social</h3><br/>
<ul>
<li class="f-ico"><img src="img-bin/mgi-logo.png" alt="" width="100%" /></li>
<li class="f-ico"><img src="img-bin/mgi-logo.png" alt="" width="100%" /></li>
<li class="f-ico"><img src="img-bin/mgi-logo.png" alt="" width="100%" /></li>
</ul>
</div>
<div class="col f-txt">
<h3 class="f-h">Find Us</h3><br/>
MGI Technology<br/>
<br/>
MAP
</div>
</div>
</div>
</section>
Any assistance I can get with this would be greatly appreciated...
Update: Have now tried vertical-align:top; and removed float:left. Issue persists.
Temporary Live Example
your snippet is not showing any issue but anyhow, but it seems that's due to by default inline-block is vertical-align:baseline, so you must set to vertical-align:top
plus remove unnecessary float:left
#f-wrap {
position: relative;
width:100%;
margin: 0 auto;
}
.row {
display: inline-block;
vertical-align:top;
width: 100%;
}
.col {
display: inline-block;
vertical-align:top;
width: 45%;
margin: 2em 1em;
background: #f0f;
}
<section class="ctre s-f">
<div id="t-wrap">
<div class="row">
<div class="col">
<img src="img-bin/mgi-logo.png" alt="MGI Technology logo." width="20%"/>
</div>
<div class="col">
<h3 class="f-h">Related Links</h3><br/>
<ul>
<li class="f-lnk">Home</li>
<li class="f-lnk">About us</li>
<li class="f-lnk">Products</li>
<li class="f-lnk">News</li>
<li class="f-lnk">Contact us</li>
<li class="f-lnk">Recycle</li>
<li class="f-lnk">Site map</li>
</ul>
</div>
</div>
<hr class="style-two"/>
<div class="row">
<div class="col">
<h3 class="f-h">Social</h3><br/>
<ul>
<li class="f-ico"><img src="img-bin/mgi-logo.png" alt="" width="100%" /></li>
<li class="f-ico"><img src="img-bin/mgi-logo.png" alt="" width="100%" /></li>
<li class="f-ico"><img src="img-bin/mgi-logo.png" alt="" width="100%" /></li>
</ul>
</div>
<div class="col f-txt">
<h3 class="f-h">Find Us</h3><br/>
MGI Technology<br/>
<br/>
MAP
</div>
</div>
</div>
</section>
UPDATE:
Looking at your live site, the issue is that the other col has another class f-txt which has a property font-size:8pt and with that, change the height of the column.
So either you apply the same class to the first .col or remove that property
Related
My HTML code is like below
<div class="col-lg-4">
<ul>
<div class="area" id="div_1">
<li class="category" id="1">Hair</li>
</div>
<div class="area" id="div_3">
<li class="category" id="3">Skin Care</li>
</div>
<div class="area" id="div_4">
<li class="category" id="4">Makeup</li>
</div>
<div class="area" id="div_5">
<li class="category" id="5">Body Treatments</li>
</div>
<div class="area" id="div_6">
<li class="category" id="6">Sports Massage</li>
</div>
<div class="area" id="div_7">
<li class="category" id="7">Physiotherapy</li>
</div>
<div class="area" id="div_8">
<li class="category" id="8">Intensive Healing Pedicure</li>
</div>
<div class="area" id="div_9">
<li class="category" id="9">Pedicure Refresher</li>
</div>
<div class="area" id="div_10">
<li class="category" id="10">Therapeutic Pedicure</li>
</div>
</ul>
</div>
My CSS code is like below
.col-lg-4 > ul {
overflow-x: scroll;
width: 100%;
display:flex;
}
.category {
border:0;
padding: 0;
margin-right: 30px;
font-size: 15px;
}
I would like to put div side by side with full width of their content and some margin right side.
I am getting output like below
I need output text will be in one line.
"I need output text will be in one line." Here's everything in one line. Basically, all you needed was white-space: nowrap. I removed the extra HTML of the divs wrapping each li since that was invalid HTML and wasn't necessary. If you need divs, put them inside the lis. I'd make them spans though.
.col-lg-4>ul {
overflow-x: scroll;
width: 100%;
display: flex;
}
.category {
border: 0;
padding: 0;
margin-right: 30px;
font-size: 15px;
display: inline-block;
white-space: nowrap;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" />
<div class="col-lg-4">
<ul>
<li class="category" id="1">Hair</li>
<li class="category" id="3">Skin Care</li>
<li class="category" id="4">Makeup</li>
<li class="category" id="5">Body Treatments</li>
<li class="category" id="6">Sports Massage</li>
<li class="category" id="7">Physiotherapy</li>
<li class="category" id="8">Intensive Healing Pedicure</li>
<li class="category" id="9">Pedicure Refresher</li>
<li class="category" id="10">Therapeutic Pedicure</li>
</ul>
</div>
In a grid layout, content must be placed inside columns (.col and .col-*) and only columns may be the immediate children of rows (.row). Rows should be placed inside a .container or .container-fluid for proper padding and alignment.
<div class="container">
<!--Row with two equal columns-->
<div class="row">
<div class="col-md-6">Column left</div>
<div class="col-md-6">Column right</div>
</div>
</div>
The width of col-lg-4 is only 25% of the page. The text is getting cramped because of this. You can change it to col-lg-12 to occupy the whole page.
.col-lg-12>ul {
overflow-x: scroll;
width: 100%;
display: flex;
}
.category {
border: 0;
padding: 0;
margin-right: 30px;
font-size: 15px;
}
try this instead,
First of all remove all div inside the ,
Then,add this style,
.col-lg-4 > ul {
overflow-x: scroll;
white-space:nowrap;
margin:0;
}
.category {
margin-right: 30px;
font-size: 15px;
display:inline-block;
}
white-space:nowrap makes the inline. More info about white-space
All <li> makes inline by display:inline-bock. More info about display
.col-lg-4 > ul {
overflow-x: scroll;
white-space:nowrap;
margin:0;
}
.category {
margin-right: 30px;
font-size: 15px;
display:inline-block;
}
<div class="col-lg-4">
<ul>
<li class="category" id="1">Hair</li>
<li class="category" id="3">Skin Care</li>
<li class="category" id="4">Makeup</li>
<li class="category" id="5">Body Treatments</li>
<li class="category" id="6">Sports Massage</li>
<li class="category" id="7">Physiotherapy</li>
<li class="category" id="8">Intensive Healing Pedicure</li>
<li class="category" id="9">Pedicure Refresher</li>
<li class="category" id="10">Therapeutic Pedicure</li>
</ul>
</div>
my html page has this unwanted white patch in the bottom and I don't know why. I don't want to be able to scroll down that long. It stays there regardless by default. it dissapears when I hover on the left(front) element but reappears when I hover on the right(behind) element.
here is the codepen : https://codepen.io/aronnora/pen/ExjJrag
<nav class="nav_bar">
<img src="580b57fcd9996e24bc43c4f8.png" alt="logo" class="logo" id="logo">
<div class="trans" id="trans"> trans energy solutions </div>
<ul class="ul">
<li class="li1">Home</li>
<li class="li2">About Us</li>
<li class="li3">Products</li>
<li class="li4">Services</li>
<li class="li5">Facility</li>
<li class="li6">Testing</li>
<li class="li7">Clients</li>
<li class="li8">Contact</li>
</ul>
</nav>
<div class="white">
</div>
<div class="pro">
<div class="text">
PRODUCTS
</div>
</div>
<div class="total">
<div class="one">
<img src="liquid-immersed-distribution-transformers-768x784.png" alt="kakashi" class="Kakashi" height="300rem"></img>
<div class="downtextone">
時メユ郎護ヲテ写藤くクッル起稲ロチ製資ヌ米更ナ池天ワア由時テ栃94探容ケニ災逮はぴ氷可難智む。能ざラくな静盟ごぼじ不注更ルモト点究サトケ別意マワ抜博写ミ元
</div>
</div>
<div class="two">
<img src="transtech-2.png" alt="madara" class="Madara" height="300rem"></img>
<div class="downtexttwo">
時メユ郎護ヲテ写藤くクッル起稲ロチ製資ヌ米更ナ池天ワア由時テ栃94探容ケニ災逮はぴ氷可難智む。能ざラくな静盟ごぼじ不
</div>
</div>
</div>
your div takes a default height as it's content. so just add overflow:hidden; to class (.tow)
.two {
height: 58.29rem;
width: 45rem;
transition: opacity 1s;
background-color: black;
position: absolute;
z-index: 10;
overflow: hidden;
}
This question already has answers here:
Sticky footer with sticky header?
(2 answers)
Closed 6 years ago.
I think my coding is correct, but I still can't put the footer to the bottom of the page, and I really need to do it.
The footer on the result appears directly under the header which is annoying as I want it to go into my main div which is located in my body.
Thanks. :)
<!DOCTYPE html>
<html>
<head>
<title>Gallery</title>
<link type="text/css" rel="stylesheet" href="mobile.css"/>
</head>
<body>
<div id="header">
<div id="companyname">Shutter Up Photography</div>
<div id="nav">
<ul>
<li>Contact Us</li>
<li>Experience</li>
<li>Offers</li>
<li>Gallery</li>
<li>Location</li>
<li>About Us</li>
<li>Home</li>
</ul>
</div>
</div>
<div id="main">
<div id="content">
<div class="img">
<img src="img_model.jpg"/>
<div class="desc">Model Shot</div>
</div>
<div class="img">
<img src="img_classy.jpg"/>
<div class="desc">A classy family shot</div>
</div>
<div class="img">
<img src="img_father.jpg"/>
<div class="desc">A father and his boys</div>
</div>
<div class="img">
<img src="img_wedding.jpg"/>
<div class="desc">Timeless Wedding Shot</div>
</div>
<div class="img">
<img src="img_mother.jpg"/>
<div class="desc">A mother and her children</div>
</div>
<div class="img">
<img src="img_kid.jpg"/>
<div class="desc">Imaginative Kid</div>
</div>
</div>
</div>
<div id="footer">
<div id="companyname">Shutter Up Photography</div>
</div>
</body>
</html>
This is the result from my coding, I've tried to put the css gallery into the main div, but won't work
This is my css code for it
Add a wrapper with the following CSS attributes as the code below. This should do the trick:
html,
body {
height: 100%;
}
#wrap {
min-height: 100%;
}
#main {
overflow: auto;
padding-bottom: 150px;
/* must be same height as the footer */
}
#footer {
position: relative;
margin-top: -150px;
/* negative value of footer height */
height: 150px;
border-bottom-style: solid;
clear: both;
background-color: #006BFE;
border: 2px solid red;
/* remove border, showns for illustration purposes only */
}
div.img {
margin: 5px;
display: inline-block;
width: 400px;
border: 1px solid blue;
padding: 10px;
}
div.img img {
width: 100%;
height: auto;
border: 2px solid #006bFE;
}
div.desc {
padding: 15px;
text-align: center;
}
.somelist {
list-style-type: square;
list-style-position: inside;
float: none;
line-height: 1.5em;
background-color: #93dbfe;
}
<div id="wrap">
<div id="header">
<div id="companyname">Shutter Up Photography</div>
<div id="nav">
<ul>
<li>Contact Us
</li>
<li>Experience
</li>
<li>Offers
</li>
<li>Gallery
</li>
<li>Location
</li>
<li>About Us
</li>
<li>Home
</li>
</ul>
</div>
</div>
<div id="main">
<div id="content">
<div class="img">
<img src="http://lorempixel.com/300/300/people" />
<div class="desc">Model Shot</div>
</div>
<div class="img">
<img src="http://lorempixel.com/300/300/people" />
<div class="desc">A classy family shot</div>
</div>
<div class="img">
<img src="http://lorempixel.com/300/300/people" />
<div class="desc">A father and his boys</div>
</div>
<div class="img">
<img src="http://lorempixel.com/300/300/people" />
<div class="desc">Timeless Wedding Shot</div>
</div>
<div class="img">
<img src="http://lorempixel.com/300/300/people" />
<div class="desc">A mother and her children</div>
</div>
<div class="img">
<img src="http://lorempixel.com/300/300/people" />
<div class="desc">Imaginative Kid</div>
</div>
</div>
</div>
</div>
<div id="footer">
<div id="companyname">Shutter Up Photography</div>
</div>
Its because your images are being floated which takes them out of the flow of the page.
Try this
div div div.img {
margin: 5px;
border: 2px solid blue;
display: inline-block;
width: 400px;
}
By removing the float and replacing with inline block you keep the elements within the flow of the page.
EDIT -
HTML -
<div class="img">
<img/>
</div><div class="img">
<img/>
</div><div class="img">
<img/>
</div>
If you choose to use inline-block, layer your html like this, as inline-block elements take into consideration the white space between elements.
**/ EDIT **
Or if you wish to keep the float, create a clearfix class and attach it to the parent
.clearfix:after {
content: "";
display: table;
clear: both;
}
EDIT -
<div id="content" class="clearfix">
<!-- your floated divs here -->
</div>
I am trying to display several social media icons side by side in a footer. I have tried using the float: left property which did not work. Can someone spot my error?
I have the following html code:
<div id="footer">
<div id="v_line"></div>
<div class="social-popout">
<div class="columns">
<ul id="lpro">
<div class="fbicon"><img id="social_me" src="facebook.png" alt="Facebook">
</ul>
<ul>
<div class="linkedin_amandasopkin"><img id="social_me" src="linkedin.png" alt="Linked In">
</ul>
<ul>
<img id="social_me" src="googleplus.png" alt="Google Plus">
</ul>
</div>
</div>
</div>
And the following CSS:
.social_me {
display: inline-block;
margin-left: auto;
margin-right: auto;
height: 30px;
}
Remove unnecessary ul tags and add li to each item
CSS:
ul li {
display:inline-block;
}
HTML:
<ul id="lpro">
<li><div class="fbicon"><img id="social_me" src="facebook.png" alt="Facebook">
</li>
<li><div class="linkedin_amandasopkin"><img id="social_me" src="linkedin.png" alt="Linked In">
</li>
<li><img id="social_me" src="googleplus.png" alt="Google Plus">
</li>
</ul>
DEMO
Just correcting some html errors:
1) Remove the unnecessary ul
2) Remove the div inside the <a> tags
3) Your id="social_me" is wrong.. It is a class, not an id.
4) After that, no need for css what so ever (<a> and <img> tags are already inline elements by default): http://jsfiddle.net/M665q/
<div id="footer">
<div class="social-popout">
<div class="columns">
<a class="social_me" href="https://www.facebook.com/" target="_blank"><img src="facebook.png" alt="Facebook" /></a>
<a class="social_me" href="https://www.linkedin.com/" target="_blank"><img src="linkedin.png" alt="Linked In" /></a>
<a class="social_me" href="https://plus.google.com/" target="_blank"><img src="googleplus.png" alt="Google Plus" /></a>
</div>
</div>
</div>
Put them all in one <ul> and the <div> tags next to the images was messing it up.
Something like this should work:
<div id="footer">
<div id="v_line"></div>
<div class="social-popout">
<div class="columns">
<ul id="lpro">
<img id="social_me" src="facebook.png" alt="Facebook">
<img id="social_me" src="linkedin.png" alt="Linked In">
<img id="social_me" src="googleplus.png" alt="Google Plus">
</ul>
</div>
</div>
</div>
<ul id="navlist">
<li><div class="fbicon"><img id="social_me" src="facebook.png" alt="Facebook"></li>
<li><div class="linkedin_amandasopkin"><img id="social_me" src="linkedin.png" alt="Linked In"></li>
<li><img id="social_me" src="googleplus.png" alt="Google Plus"></li>
</ul>
#navlist li
{
display: inline;
list-style-type: none;
padding-right: 20px;
float: left;
}
it sounds like you're having a problem linking your CSS to your HTML page. Try putting it into the head.
<html>
<head>
<style type="text/css">
.lpro li {
float: left;
padding: .5em;
list-style-type: none;
}
</style>
</head>
<div id="footer">
<div class="social-popout">
<div class="columns">
<ul class="lpro">
<li><img src="facebook.png" alt="Facebook"></li>
<li><img src="linkedin.png" alt="Linked In"></li>
<li><img src="googleplus.png" alt="Google Plus"></li>
</ul>
</div>
</div>
</div>
</html>
I was able to get it working by creating three different unordered lists. I used:
.column {
float:left;
padding: 10px 20px 0px 10px;
}
ul{
list-style-type:none;
padding-left:0px;
text-decoration:none;
padding-top: 10px;
}
.title-logo{
color: #5E81F4;
font-family: 'Inter', sans-serif;
margin-left: 10px;
}
.logo a{
display: flex;
justify-content: start;
align-items: center;
}
<div class="logo">
<a href="/#">
<div class="shap-logo">
<H1>O</H1>
</div>
<h3 class="title-logo">Ohara</h3>
</a>
</div>
I tried this for my code, but I don't know it's correct or not.
Got a small issue with this website structure: www.bigideaadv.com/xsp
Looking to have this container fill the middle of the screen between the top and bottom navigation. I'd also like to have the middle collapse with the resizing of the window with a scrollbar. Can't seem to make it work quite right. Anyone have any thoughts?
<div id="top_navigation">
<div id="navigation_inside">
<ul id="navigation">
<li>Schedule Demo</li>
<li>Sales</li>
<li><p style="float:left; margin:0;">Search</p> <form style="margin:0 0 0 5px; padding:0; float:left;"><input class="search" type="text" /><input type="hidden"></form></li>
</ul>
<ul id="navigation2">
<li>Home</li>
<li>About</li>
<li>Products</li>
<li>People</li>
<li>News + Events</li>
<li>Contact</li>
</ul>
</div>
</div>
<div id="container">
<div id="scroller">
</div>
</div>
<div id="bottom_navigation">
<div id="twitter_bar">
<div id="twitter">
<h5><img src="images/twitter_bird.png" width="23" height="16" /> <b>#XSPGlobal:</b> </h5>
<p>Loading...</p>
<noscript><h5>This feature requires JavaScript</h5></noscript>
</div>
</div>
<div id="blog_posts">
<p>Here is where the blog posts will go.</p>
</div>
<div id="bottom_navigation_inside">
<ul>
<li>Partners</li>
<li>Interfaces</li>
<li>Careers</li>
<li>XACT Blog</li>
<li>Milestones</li>
<li>Awards + Recognition</li>
<li>Client Testimonials</li>
<li>Press Releases</li>
<li>Social Responsibility</li>
<li>Privacy Policy</li>
<li>Terms & Conditions</li>
</ul>
</div>
<div id="social_links">
<img src="images/facebook.png" width="23" height="24" />
<img src="images/twitter.png" width="23" height="24" />
<img src="images/linkedin.png" width="23" height="24" />
</div>
</div>
CSS:
#container {
margin: 72px 0 72px 0;
width: 100%;
height: 100%;
}
#top_navigation {
position: fixed;
min-width: 1010px;
width: 100%;
height: 72px;
background: url('../images/opaque.png') repeat;
text-transform: uppercase;
}
#bottom_navigation {
position: absolute;
min-width: 1010px;
width: 100%;
height: 172px;
background: url('../images/opaque.png') repeat;
text-transform: uppercase;
}
set the container to position fixed with a top of 72px and a bottom of 172px.