Place div side by side - html

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>

Related

Unnecesary height of html page

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;
}

Phantom top margin on float left

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

Overriding Bootstrap Container Full Width Background Color

I'm trying to have my container divs background color extend to the full width of the browser. Right now I am unable to bypass the container styling set up by default in bootstrap, despite adding my own class to the container. The only styling that works is the background-color. I have also tried the following CSS, but it didn't make any change.
margin-right: auto;
margin-left: auto;
padding-left: 0px;
padding-right: 0px;
background-color: #FDDC00;
Here is my HTML:
<div class="container selection-section">
<div class="row pattern-choice">
<div class="col-md-12">
<h2><i>Choose a pattern</i></h2>
<ul>
<li class="button-border">
<h3 class="button-choice" >SOLID</h3>
</li>
<li class="button-border">
<h3 class="button-choice" id="stripe-choice">STRIPE</h3>
</li>
<li class="button-border">
<h3 class="button-choice" id="plaid-choice">PLAID</h3>
</li>
</ul>
</div>
</div>
</div>
Here is my CSS:
.selection-section {
margin-right: auto;
margin-left: auto;
padding-left: 0px;
padding-right: 0px;
background-color: #FDDC00;
}
Use container-fluid instead of container if you want the container to extend to the full-width of your webpage.
If it's only the color that's a concern surrounding the container with another div might work for you.
.selection-section {
background: #FDDC00;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="selection-section">
<div class="container">
<div class="row pattern-choice">
<div class="col-md-12">
<h2><i>Choose a pattern</i></h2>
<ul>
<li class="button-border">
<h3 class="button-choice">SOLID</h3>
</li>
<li class="button-border">
<h3 class="button-choice" id="stripe-choice">STRIPE</h3>
</li>
<li class="button-border">
<h3 class="button-choice" id="plaid-choice">PLAID</h3>
</li>
</ul>
</div>
</div>
</div>
</div>
<hr>
<div class="container">
<div class="well">Outside Div</div>
</div>

How to centralize the left nav

I having problems trying to centralize a bootstrap standard nav in a row.
<footer id="page_footer">
<div class="container">
<div class="row">
<div class="col-md-8">
<ul id="page_footer_links" class="nav nav-pills nav-center">
<li role="presentation">Home</li>
<li role="presentation">Profile</li>
<li role="presentation">Messages</li>
</ul>
</div>
<div class="col-md-4">
<p id="page_footer_wordpress" class="text-center">Orgulhosamente movido com WordPress!!!</p>
</div>
</div>
</div>
Here the complete fiddle: http://jsfiddle.net/vpontin/bkpnrLo0/
I tried putting text-center and center-block. None worked. Even putting margin 0 auto or text-align: center didn't work.
What i need to do?
The .nav-pills list items have default floating behavior to left. So change it to none and display them in one line using display: inline-block.
Updated JSfiddle
#page_footer {
background-color: #f5f5f5;
width: 100%;
}
#page_footer .container {
padding: 20px;
}
#page_footer_links {
margin: 0 auto;
text-align: center;
}
#page_footer_wordpress {
margin: 0px;
height: 40px;
line-height: 40px;
}
.nav-pills > li {
float: none !important;
display: inline-block !important;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<footer id="page_footer">
<div class="container">
<div class="row">
<div class="col-md-8">
<ul id="page_footer_links" class="nav nav-pills nav-center">
<li role="presentation">Home
</li>
<li role="presentation">Profile
</li>
<li role="presentation">Messages
</li>
</ul>
</div>
<div class="col-md-4">
<p id="page_footer_wordpress" class="text-center">Orgulhosamente movido com WordPress!!!</p>
</div>
</div>
</div>

Is there a way using **CSS only** (not JS) to hide an entire list item or div if a part of it is being cut off via overflow:hidden?

Firstly this question has been before (in a fashion) but without examples: Hiding an element completly that has had some overflow hidden
The Problem
I'm using the Gridster framework http://gridster.net/ to display some content and it uses a fixed height on each content area with overflow:hidden.
The content that I place in each content area could be 10 characters long or 100 characters (in a responsive framework) bootstrap and so can sometime get cut off.
Supporting Images
How it looks now
How I would like it to look
Example code
HTML
<div class="example_container">
<div class="WidgetContent pull-left">
<ul class="unstyled">
<li class="person ActivePerson">
<div class="StaffThumb pull-left">
<img src="https://cdn1.iconfinder.com/data/icons/dot/256/man_person_mens_room.png">
</div>
<div class="expert-details pull-left">
<ul class="innerBox unstyled">
<li>
James Harris
</li>
<li>Senior Management</li>
<li>London</li>
<li>VP, Marketing Communications</li>
</ul>
</div>
<div class="container-number pull-right">
<span class="label">76</span>
</div>
</li>
<li class="person ">
<div class="StaffThumb pull-left">
<img src="https://cdn1.iconfinder.com/data/icons/dot/256/man_person_mens_room.png">
</div>
<div class="expert-details pull-left">
<ul class="innerBox unstyled">
<li>
Carlos Fernandez
</li>
<li>Senior Management</li>
<li>Madrid</li>
<li>Senior Business Development Coordinator</li>
</ul>
</div>
<div class="container-number pull-right">
<span class="label">72</span>
</div>
</li>
<li class="person ">
<div class="StaffThumb pull-left">
<img src="https://cdn1.iconfinder.com/data/icons/dot/256/man_person_mens_room.png">
</div>
<div class="expert-details pull-left">
<ul class="innerBox unstyled">
<li>
Kate Evans
</li>
<li>Research</li>
<li>London</li>
<li>Communications Systems Analyst - Millar A/C Manager</li>
</ul>
</div>
<div class="container-number pull-right">
<span class="label">71</span>
</div>
</li>
<li class="person ">
<div class="StaffThumb pull-left">
<img src="https://cdn1.iconfinder.com/data/icons/dot/256/man_person_mens_room.png">
</div>
<div class="expert-details pull-left">
<ul class="innerBox unstyled">
<li>
Brian Montrose
</li>
<li>Business Development</li>
<li>New York</li>
<li>Business Development Analyst</li>
</ul>
</div>
<div class="container-number pull-right">
<span class="label">70</span>
</div>
</li>
<li class="person ">
<div class="StaffThumb pull-left">
<img src="https://cdn1.iconfinder.com/data/icons/dot/256/man_person_mens_room.png">
</div>
<div class="expert-details pull-left">
<ul class="innerBox unstyled">
<li>
Alison Roberts
</li>
<li>HR</li>
<li>San Francisco</li>
<li>HR - Pension</li>
</ul>
</div>
<div class="container-number pull-right">
<span class="label">68</span>
</div>
</li>
</ul>
</div></div>
CSS
.example_container { width:300px; height:325px; overflow:hidden; }
.WidgetContent {
width: 100%;
position: relative;
}
.pull-left {
float: left;
}
.pull-right {
float: left;
}
ul.unstyled, ol.unstyled {
list-style: none outside none;
margin-left: 0;
padding:0;
}
.ActivePerson {
background-color: #FCF8E3;
}
.person {
border-bottom: 1px dashed #E2E2E2;
display: block;
padding: 7px 50px;
}
li {
overflow: hidden;
}
.StaffThumb img {
border-radius: 3px;
height: 35px;
margin: 4px 10px 0 0;
width: 35px;
}
.StaffThumb {
left: 10px;
margin: 0;
position: absolute;
}
.container-number {
position: absolute;
right: 10px;
}
.ActivePerson .label {
background-color: #F89406;
}
.label {
font-size: 16px;
line-height: 20px;
margin: 0 5px;
position: relative;
top: 5px;
border-radius: 3px;
padding: 1px 4px 2px;
}
Example Fiddle
http://jsfiddle.net/3sTNL/
This little extra CSS: Uses flex layout
.WidgetContent {
height: 100%;
}
.WidgetContent > .unstyled {
margin: 0;
display: flex;
flex-direction: column;
flex-wrap: wrap;
float:left;
height: 100%;
}
.person {
position: relative;
}
fiddle here
YES!
Add column-width to the ul, equal to the container's width.
Add height to the ul, equal to the container's height minus padding/margin
Add break-inside:avoid (-webkit-column-break-inside) to the .people items
Result: http://jsfiddle.net/3sTNL/3/ (Tested in Chrome)
This is VERY haxy XD But it works!