<div>'s not appearing in a 'stack' - html

Sorry if this has been asked, but nothing I found worked in my case.
Here is my current code. I have included more detailed problems there, but basically some of my elements are either not appearing or appearing in unwanted locations.
https://jsfiddle.net/9e8tffh5/2/
<div class="chat">
<div class="bar">
<div class="title">
<span class="name">Random Chat</span>
</div>
</div>
<div class="options">
</div>
<div class="room">
<div class="post other" id="1">
<div class="content">
<span class="note">Hi there!</span>
</div>
<div class="details">
<div class="poster">
<span class="name">Bob</span>
</div>
<div class="time">
<span class="time">9:32</span>
</div>
</div>
</div>
<div class="post self" id="2">
<div class="content">
<span class="note">Hi Bob</span>
</div>
<div class="details">
<div class="time">
<span class="time">12:32</span>
</div>
</div>
</div>
<div class="post self" id="3">
<div class="content">
<span class="note">How are you doing?</span>
</div>
<div class="details">
<div class="time">
<span class="time">9:33</span>
</div>
</div>
</div>
<div class="post other" id="4">
<div class="content">
<span class="note">Great!</span>
</div>
<div class="details">
<div class="poster">
<span class="name">Bob</span>
</div>
<div class="time">
<span class="time">9:32</span>
</div>
</div>
</div>
</div>
<div class="message">
<div class="input">
<input type="text" placeholder="Send a message" />
</div>
</div>
</div>

fiddle
.chat .room .self {
/* position: absolute;
right: 8px; */
text-align: right;
}
.chat .room .self .details {
/* position: absolute;
right: 8px; */
text-align: right;
}

Related

How to keep the right alignment in the div table in html page?

Link for the tableI am trying to create a table using div with below code .
I need to get the right table alignment with rows and column.
Below are the css
.Table {
display: table;
}
.Title {
display: table-caption;
text-align: center;
font-weight: bold;
font-size: larger;
}
.Heading {
display: table-row;
font-weight: bold;
text-align: center;
}
.Row {
display: table-row;
}
.Cell {
display: table-cell;
border: solid;
border-width: thin;
padding-left: 25px;
padding-right: 20px;
text-align: center;
}
<div class="Heading">
<div Class="Cell">
<p>PROJECT</p>
</div>
<div Class="Cell">
<p>APPLICATION</p>
</div>
<div id="test">
<span id="headerID1" class="Cell">
<p>PRIMARY</p>
</span>
<span id="headerID2" class="cell">
<p>DISASTER</p>
</span>
<span id="Time" class="Cell">
<P> LAST CHECKED TIME</P>
</span>
</div>
</div>
<div class="Heading">
<div Class="Cell">
<p>GRABCDH</p>
</div>
<div Class="Cell">
<p>abc.com</p>
</div>
<div id="test">
<span id="PABC.th" class="Cell">
<p>ABCD</p>
</span>
<span id="DABC.th" class="cell">
<p>BCDE</p>
</span>
<span id="EABC.th" class="Cell">
<P> </P>
</span>
</div>
</div>
<div class="Heading">
<div Class="Cell">
<p>LEABCDE</p>
</div>
<div Class="Cell">
<p>bcd.com</p>
</div>
<div id="test">
<span id="Pdet.in" class="Cell">
<p>HDCF</p>
</span>
<span id="Dladt.in" class="cell">
<p>TDCP</p>
</span>
<span id="lADV.in" class="Cell">
<P> </P>
</span>
</div>
</div>
<div class="Heading">
<div Class="Cell">
<p>LABCD</p>
</div>
<div Class="Cell">
<p>CDE.COM/p>
</div>
<div id="test">
<span id="PCDE" class="Cell">
<p>SBCD</p>
</span>
<span id="DABC.in" class="cell">
<p>HABCD</p>
</span>
<span id="EABC.in" class="Cell">
<P> </P>
</span>
</div>
</div>
<div class="Heading">
<div Class="Cell">
<p>LDXY</p>
</div>
<div Class="Cell">
<p>BCD.IN</p>
</div>
<div id="test">
<span id="PDER.int" class="Cell">
<p>HDC2</p>
</span>
<span id="DlyD.int" class="cell">
<p>PLAN3</p>
</span>
<span id="lynCD.int" class="Cell">
<P> </P>
</span>
</div>
</div>
But the alignment not looks correct.
Please let me know how can make this alignment proper?
The cell and row alignment get changed based on the text inside as seen in the above link
You need a commun wrapper from which you can set the table-layout , then each sublevel is to receive the proper display for what it is supposed to do.
example of how you could start .
.tableLayout {
display:table;
}
.tableLayout > div{
display:table-row;
}
.tableLayout > div > div {
display:table-cell;
border:solid;
}
<div class="tableLayout">
<div class="Heading">
<div Class="Cell">
<p>PROJECT</p>
</div>
<div Class="Cell">
<p>APPLICATION</p>
</div>
<div id="test">
<span id="headerID1" class="Cell">
<p>PRIMARY</p>
</span>
<span id="headerID2" class="cell">
<p>DISASTER</p>
</span>
<span id="Time" class="Cell">
<P> LAST CHECKED TIME</P>
</span>
</div>
</div>
<div class="Heading">
<div Class="Cell">
<p>GRABCDH</p>
</div>
<div Class="Cell">
<p>abc.com</p>
</div>
<div id="test">
<span id="PABC.th" class="Cell">
<p>ABCD</p>
</span>
<span id="DABC.th" class="cell">
<p>BCDE</p>
</span>
<span id="EABC.th" class="Cell">
<P> </P>
</span>
</div>
</div>
<div class="Heading">
<div Class="Cell">
<p>LEABCDE</p>
</div>
<div Class="Cell">
<p>bcd.com</p>
</div>
<div id="test">
<span id="Pdet.in" class="Cell">
<p>HDCF</p>
</span>
<span id="Dladt.in" class="cell">
<p>TDCP</p>
</span>
<span id="lADV.in" class="Cell">
<P> </P>
</span>
</div>
</div>
<div class="Heading">
<div Class="Cell">
<p>LABCD</p>
</div>
<div Class="Cell">
<p>CDE.COM/p>
</div>
<div id="test">
<span id="PCDE" class="Cell">
<p>SBCD</p>
</span>
<span id="DABC.in" class="cell">
<p>HABCD</p>
</span>
<span id="EABC.in" class="Cell">
<P> </P>
</span>
</div>
</div>
<div class="Heading">
<div Class="Cell">
<p>LDXY</p>
</div>
<div Class="Cell">
<p>BCD.IN</p>
</div>
<div id="test">
<span id="PDER.int" class="Cell">
<p>HDC2</p>
</span>
<span id="DlyD.int" class="cell">
<p>PLAN3</p>
</span>
<span id="lynCD.int" class="Cell">
<P> </P>
</span>
</div>
</div>
</div>
Note: rowspan or colspan attributes have no equivalent in CSS, if you want some cells to be spanning through column or row, display:grid will be able to do it, please clarify if it is the case.

Margin property doesn't work

I am using a semantic-ui framework. I am trying to make a post-comments like structure. currently my code looks like this:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/1.11.8/semantic.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/1.11.8/semantic.min.js"></script>
<title>Assignments</title>
<style>
.items {
width: 70%;
border: solid;
margin: 100px;
}
</style>
</head>
<body>
<div class="ui items">
<div class="item">
<a class="ui tiny image">
<img src="img_avatar3.png">
</a>
<div class="content">
<a class="header">Jenny Hess</a>
<div class="metadata">
<span class="date">Today at 5:42PM</span>
</div>
<div class="description">
<p>First Post Ever In My Life</p>
</div>
</div>
</div>
<div class="ui comments">
<div class="comment">
<a class="avatar">
<img src="img_avatar3.png">
</a>
<div class="content">
<a class="author">Matt</a>
<div class="metadata">
<span class="date">Today at 5:42PM</span>
</div>
<div class="text">
How artistic!
</div>
</div>
</div>
<div class="comment">
<a class="avatar">
<img src="img_avatar3.png">
</a>
<div class="content">
<a class="author">Elliot Fu</a>
<div class="metadata">
<span class="date">Yesterday at 12:30AM</span>
</div>
<div class="text">
<p>This has been very useful for my research. Thanks as well!</p>
</div>
</div>
</div>
<div class="comment">
<a class="avatar">
<img src="img_avatar3.png">
</a>
<div class="content">
<a class="author">Joe Henderson</a>
<div class="metadata">
<span class="date">5 days ago</span>
</div>
<div class="text">
Dude, this is awesome. Thanks so much
</div>
</div>
</div>
<form class="ui reply form">
<div class="field">
<textarea rows="3" cols="50"></textarea>
</div>
<div class="ui blue labeled submit icon button">
<i class="icon edit"></i> Add Reply
</div>
</form>
</div>
</div>
<div class="ui items">
<div class="item">
<a class="ui tiny image">
<img src="img_avatar3.png">
</a>
<div class="content">
<a class="header">Jenny Hess</a>
<div class="metadata">
<span class="date">Today at 5:42PM</span>
</div>
<div class="description">
<p>First Post Ever In My Life</p>
</div>
</div>
</div>
<div class="ui comments">
<div class="comment">
<a class="avatar">
<img src="img_avatar3.png">
</a>
<div class="content">
<a class="author">Matt</a>
<div class="metadata">
<span class="date">Today at 5:42PM</span>
</div>
<div class="text">
How artistic!
</div>
</div>
</div>
<div class="comment">
<a class="avatar">
<img src="img_avatar3.png">
</a>
<div class="content">
<a class="author">Elliot Fu</a>
<div class="metadata">
<span class="date">Yesterday at 12:30AM</span>
</div>
<div class="text">
<p>This has been very useful for my research. Thanks as well!</p>
</div>
</div>
</div>
<div class="comment">
<a class="avatar">
<img src="img_avatar3.png">
</a>
<div class="content">
<a class="author">Joe Henderson</a>
<div class="metadata">
<span class="date">5 days ago</span>
</div>
<div class="text">
Dude, this is awesome. Thanks so much
</div>
</div>
</div>
<form class="ui reply form">
<div class="field">
<textarea rows="3" cols="50"></textarea>
</div>
<div class="ui blue labeled submit icon button">
<i class="icon edit"></i> Add Reply
</div>
</form>
</div>
</div>
</body>
</html>
As you can see I have made items width 70% and margin auto but it doesn't center. Can someone suggest me why?
Give a specific id to parent of such item and give
text-align: center;
styling to it
Let me know if you require further help

Force element to move up

I have a box that is rendering lower and I cant figure out why.
<div id="hint-history" class="popup">
<div class="row">
<div class="col" id="closehistorypopup">
<div class="body">
<button class="x">
<span class="sprite close"></span>
</button>
<div class="title">Hint History</div>
<div class="lists">
<?php for($i=0;$i<6;$i++) { ?>
<div class="list history[[$i]]" id="history[[$i]]">
<div class="info">
<div class="picture monophoto">
<div class="text">BO</div>
<div class="img" style="background-image: url();"></div>
</div>
<div class="right">
<div class="lineone">John Smith</div>
<div class="linetwo">Daily Essentials</div>
</div>
</div>
<div class="boxes">
<div class="left">
<div class="box box1"></div>
</div>
<div class="right">
<div class="box box2"></div>
<div class="box box3"></div>
</div>
</div>
<a class="cbutton whiteonblack">VIEW LIST<!--SEE <span class="owner">JOHN'S</span>--></a>
</div>
<?php } ?>
<?php $i++; $privateCount = 1; ?>
#if ($privateCount > 0)
<div id="privatecard" class="list history[[$i]]">
<div class="info">
<div class="picture monophoto" style="visibility: hidden;">
</div>
<div class="right">
<p id="privatecounter">
#if ($privateCount == 1)
There is [[$privateCount]] private user.
#else
There are [[$privateCount]] private users.
#endif
</p>
<div class="linetwo"> </div>
<div class="linetwo"> </div>
<div class="linetwo"> </div>
</div>
</div>
<div class="boxes">
<div class="left">
</div>
<div class="right">
</div>
</div>
</div>
#endif
</div>
No matter what I do it wont budge.
.privatecard {
margin-top: -500px !important;
}
.privatecard {
padding-bottom: 500px !important;
}
//etc
How can I force it to move up?
Post a fiddle?
I've had this issue in the past though, and I've resolved it by a combination of making sure all inline-block elements are also vertical-align:top; (or any other state, as long as it's all consistent). AND then, set a min-height to the parent container, and a min-height to all the inline-block'd elements

Keeping divs(social icons) centered when removing some

I have some social icons on my wordpress theme I am working on, and I am trying to add the ability to select which icons to use. The problem is that when I remove icons, it automatically will mess up the alignment, because I use an offset on the first icon, and an extra class on another. Now I figured out a way around this(although not working as of yet), but after working on it I realized it is a little rediculous for me to mask bad css with a gigantic PHP function to help me work with the the problematic css. This approach can be seen here: https://wordpress.stackexchange.com/questions/126611/cannot-seem-to-get-a-value-or-key-from-array
So I am wondering if anyone could help me fix my social icons so that if I remove them it will not move their alignment from the center. So it always looks centered and even. Here is a JS fiddle of the icons: http://jsfiddle.net/g2SC4/
Here is a look at the HTML. In total there is 6 icons:
<!-- start: social icon -->
<div id="social-icons">
<div class="section-wrapper section-icon social-icon">
<div class="container">
<div class="row">
<div class="social-icon-phone clear-phone">
<div class="span1 offset3">
<div class="flip-container">
<div class="flipper">
<div class="front">
<div class="flip-a">
<i class="icon-facebook icon-2x"></i>
</div>
</div>
<div class="back">
<div class="flip-b facebook">
<span class="icon-back"><i class="icon-facebook icon-2x"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="span1">
<div class="flip-container">
<div class="flipper">
<div class="front ">
<div class="flip-a">
<i class="icon-twitter icon-2x"></i>
</div>
</div>
<div class="back">
<div class="flip-b twitter">
<span class="icon-back"><i class="icon-twitter icon-2x"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="span1">
<div class="flip-container">
<div class="flipper">
<div class="front ">
<div class="flip-a">
<i class="icon-google-plus icon-2x"></i>
</div>
</div>
<div class="back">
<div class="flip-b google">
<span class="icon-back"><i class="icon-google-plus icon-2x"></i></span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="social-icon-phone clear-phone">
<div class="span1">
<div class="flip-container">
<div class="flipper">
<div class="front ">
<div class="flip-a">
<i class="icon-github icon-2x"></i>
</div>
</div>
<div class="back">
<div class="flip-b github">
<span class="icon-back"><i class="icon-github icon-2x"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="span1">
<div class="flip-container">
<div class="flipper">
<div class="front ">
<div class="flip-a">
<i class="icon-pinterest icon-2x"></i>
</div>
</div>
<div class="back">
<div class="flip-b pinterest">
<span class="icon-back"><i class="icon-pinterest icon-2x"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="span1">
<div class="flip-container">
<div class="flipper">
<div class="front ">
<div class="flip-a">
<i class="icon-linkedin icon-2x"></i>
</div>
</div>
<div class="back">
<div class="flip-b linkedin">
<span class="icon-back"><i class="icon-linkedin icon-2x"></i></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div><!-- end: social icon -->
</div>
Here is the solution.
Remove the class offset3 from the first icon(span) and the following CSS:
.social-icon-phone.clear-phone {
display: inline-block;
}
#social-icons .row {
text-align: center; // remove margin left -30px
}

bootstrap affix floats all the way to the left when scroll

I have a div within a container that I would like to stay fixed on the right side of the screen. But when the user start to scrolls it just shifts all the way to the left. Thanks for any help.
http://jsfiddle.net/kbLak/
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap.min.css" rel="stylesheet">
recent things:
</div>
</div>
</div>
<div class="explore_recentAlbums" data-spy="affix" data-offset-top="20">
<div class="ex_recentBar">
<div class="ex_titleDetails">
<span>recent stuff: </span>
</div>
</div>
<table>
<tr>
<td>
<div class="well well-small" style="margin-bottom: 1px;">
<span>Recent</span>
</div>
<span class="NoDataFound">No Photo.</span>
<div class="smallalbumcover">
<div class="mosaic-blocksmall mofade">
<div class="mosaic-overlay">
<div class="details">
<p>
xzxz
</p>
</div>
</div>
<div class="mosaic-backdrop">
<img src=""/>
</div>
</div>
<div class="clearfix">
</div>
</div>
<div style="margin-bottom: 1em; text-align: center; margin-top: 10px;">
<a style="text-decoration: none;" href="/pics"><span class="label label-info">View More</span></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="well well-small" style="margin-bottom: 1px;">
<span>Recent Video Albums</span>
</div>
<span class="NoDataFound">No Video.</span>
<div class="smallalbumcover">
<div class="mosaic-blocksmall mofade">
<div class="mosaic-overlay">
<div class="details">
<p>
test
</p>
</div>
</div>
<div class="mosaic-backdrop">
<img src="#"/>
</div>
</div>
<div class="clearfix">
</div>
</div>
<div style="margin-bottom: 1em; text-align: center; margin-top: 10px;">
<a style="text-decoration: none;" href="/vids"><span class="label label-info">View More</span></a>
</div>
</td>
</tr>
<tr>
<td>
<div class="well well-small" style="margin-bottom: 1px;">
<span>Recent P</span>
</div>
<span class="NoDataFound">No.</span>
<div class="smallalbumcover">
<div class="mosaic-blocksmall mofade">
<div class="mosaic-overlay">
<div class="details">
<p>
test
</p>
</div>
</div>
<div class="mosaic-backdrop">
<img src=""/>
</div>
</div>
<div class="clearfix">
</div>
</div>
<div style="margin-bottom: 1em; text-align: center; margin-top: 10px;">
<a style="text-decoration: none;" href="/aio"><span class="label label-info">View More</span></a>
</div>
</td>
</tr>
</table>
</div>
​
Add this to your css and it will stay to the right:
.explore_recentAlbums {
right: 0;
}