I need a table layout that looks like the following:
Cell one (rowspan 2)
Cell two and three (next to cell one and each other)
Cell four (colspan 2 underneath cell two and three)
The problem I am having though is that it needs to be done using CSS only, I can't use any table elements in the Code at all.
Cell 1 also needs to still stretch to a 100% width if Cell 2, 3 and 4 are empty.
I am working on an Artisteer 4 Template in Joomla and have searched all over and just can't get to a working solution.
The code I have is as follows:
<div class="prof-layout-wrapper">
<div class="prof-content-layout">
<div class="prof-content-layout-row">
<div class="prof-layout-cell prof-content">
<?php
echo $view->position('banner2', 'prof-nostyle');
if ($view->containsModules('breadcrumb'))
echo artxPost($view->position('breadcrumb'));
echo $view->positions(array('user1' => 50, 'user2' => 50), 'prof-article');
echo $view->position('banner3', 'prof-nostyle');
echo artxPost(array('content' => '<jdoc:include type="message" />', 'classes' => ' prof-m essages'));
echo '<jdoc:include type="component" />';
echo $view->position('banner4', 'prof-nostyle');
echo $view->positions(array('user4' => 50, 'user5' => 50), 'prof-article');
echo $view->position('banner5', 'prof-nostyle');?>
</div>
<?php if ($view->containsModules('left')) : ?>
<div class="prof-layout-cell prof-sidebar1">
<?php echo $view->position('left', 'prof-block'); ?>
</div>
<?php endif; ?>
<?php if ($view->containsModules('right')) : ?>
<div class="prof-layout-cell prof-sidebar2">
<?php echo $view->position('right', 'prof-block'); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
The css is:
.prof-layout-wrapper
{
position: relative;
margin: 0 auto 0 auto;
z-index: auto !important;
}
.prof-content-layout
{
display: table;
width: 100%;
table-layout: fixed;
float: left;
}
.prof-content-layout-row
{
display: table-row;
}
.prof-layout-cell
{
display: table-cell;
vertical-align: top;
}
For the life of me I can't get Cell 4 to span accross without destroying the entire layout.
Please help!
(I hope this is a good enough explanation)
Sure!
Demo Fiddle
HTML
<div class='table'>
<div class='row'>
<div class='cell'>cell1</div>
<div class='cell'>
<div class='table'>
<div class='row'>
<div class='cell'>cell2</div>
<div class='cell'>cell3</div>
</div>
<div class='caption'>cell4</div>
</div>
</div>
</div>
</div>
CSS
html, body {
width:100%;
}
.table {
display:table;
width:100%;
}
.row {
display:table-row;
}
.cell {
display:table-cell;
border:1px solid grey;
}
.caption {
display:table-caption;
caption-side:bottom;
border:1px solid grey;
}
If you want the auto expanding/collapse functionality, you can tweak the code slightly, a la this fiddle
Related
After submitting the message page is reloading with message box content scrolled up. I want scrolled down as shown in image like facebook messenger. I am trying many ways but not getting the proper output.
chat form
<?php foreach ($b_to_c as $row) { ?>
<?php
if ($row->From == 'customer') {
?>
<div class="left">
<div class="row">
<div class="col-md-1">
<?php if (empty($roww->customer_image[0]) || empty($roww->supplier_image)) { ?>
<img src="<?php echo base_url(); ?>images/default.jpg" class="img-circle" width="30px" height="30px"/>
<?php } else { ?>
<img src="<?php echo 'data:image;base64,' . $roww->supplier_image; ?>" class="img-circle" width="30px" height="30px"/>
<?php } ?>
<!--<img src="<?php // echo 'data:image;base64,' .$roww->supplier_image; ?>" class="img-circle" width="30px" height="30px"/>-->
</div>
<div class="col-md-11">
<div class="left_msg_block">
<?php $timestamp1 = strtotime($row->msg_sent_time); ?>
<?php $mesgtimming = date(' D-h:i A', $timestamp1); ?>
<div class="left_messagetext"><?php echo $row->message; ?></div>
</div>
</div>
</div>
</div>
<?php } else { ?>
<div class="right">
<div class="row">
<div class="col-md-12">
<div class="right_msg_block">
<?php $timestamp1 = strtotime($row->msg_sent_time); ?>
<?php $mesgtimming = date(' D-h:i A', $timestamp1); ?>
<div class="right_messagetext"><?php echo $row->message; ?></div>
</div>
</div>
</div>
</div>
<?php
}
}
?>
css code
.left_messagetext a{
color: rgba(0, 0, 0, 1);
}
.right_messagetext{
background-color: #0084ff;
margin: 1px 0;
padding: 6px 12px;
word-wrap: break-word;
clear: right;
float: right;
border-bottom-left-radius: 1.3em;
border-top-left-radius: 1.3em;
max-width: 60%;
}
.right_messagetext a{
color:#fff;
}
.scrollstarts{
overflow-y:scroll;
max-height: 500px;
overflow-x:hidden;
padding:3%;
}
.left_messagetext{
background-color: #d0cbcb;
margin: 1px 0;
padding: 6px 12px;
border-bottom-right-radius: 1.3em;
border-top-right-radius: 1.3em;
clear: left;
float: left;
word-wrap: break-word;
max-width: 60%;
}
controller code
$data['b_to_c'] = $this->Profile_model->Buyer_s($pid);
$this->load->view('buyermessageview', $data)
Model code
public function Buyer_s($pid) {
$this->db->select('*');
$this->db->from('communication');
$this->db->join('supplier_otherdetails', 'supplier_otherdetails.supplierid_fk = communication.supplier_id');
$this->db->join('customer_registration', 'communication.Customer_id=customer_registration.id');
$array = array('communication.product_id' => $pid, 'communication.Customer_id' => $this->session->id);
// $where = "communication.From='customer' and 'communication.Customer_id',$this->session->id";
$this->db->where($array);
$this->db->order_by("msg_sent_time", "asc");
$query = $this->db->get();
$results = [];
if ($query->num_rows() > 0) {
$results = $query->result();
}
return $results;
}
You could maybe use javascript to scroll to the bottom of the page?
Example:
<script>
// scroll to the bottom of the page
window.scrollTo(0,document.body.scrollHeight);
</script>
Or, if it's just in the message-box you want to go down, you could use:
<script>
// scroll to the bottom of messagediv
var messageDiv = document.getElementById("your_div");
messageDiv.scrollTop = messageDiv.scrollHeight;
</script>
You could of course wrap the script in a function and call it whenever, on a timed basis with setTimeout() or on page load etcetera...
I have a white space appearing between the two div elements
col3-2 and the_content which I have been unable to resolve.
Visit site here
You can see the white gap between the image, and the green element.
HTML - PHP:
<div id="imageslider" class="clearfix">
<?php echo do_shortcode('[advps-slideshow optset="1"]'); ?>
</div>
<div class="col3-2">
<div id="content" class="clearfix">
<?php
$args = array( 'pagename' => 'home' );
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="the_content">
<?php the_content(); ?>
<?php edit_post_link(__('Click to edit this content','themify'), '[', ']'); ?>
</div>
<?php endwhile; wp_reset_query();?>
</div>
</div>
CSS:
.col3-2
{
float: left;
margin-left: 0%;
}
.col3-2 {
width: 100%;
font-family: 'Titillium Web', sans-serif;
}
.col3-2 h1 {
margin-right: 20px;
font-size:300%;
}
.the_content{
display: none;
}
#content {
float: left;
padding: 0 0 0%;
width: 100%;
}
The problem lies in an extraneous <p> tag appearing in the div.the_content tag:
<div class="col3-2">
<div id="content" class="clearfix">
<div class="the_content">
<p></p>
...
It looks like you're pulling this in from somewhere else, so editing the code you posted probably won't help much. Simply remove the <p></p> from the source of the content.
As stated in a previous answer, the problem is due to the p element in the code snippet:
<div id="imageslider" class="clearfix">
...
</div>
<div class="col3-2">
<div id="content" class="clearfix">
<div class="the_content">
<p></p> <!-- this causes the problem... -->
<div id="section1">
<p></p>
...
Removing the p could solve the problem, but since the content can be edited in the future (Wordpress is the CMS in this case), then the p could reappear if the user editing the content inserts an extra carriage return or two in a WYSIWIG inline editing window.
The issue is due to collapsing margins between the p (and the containing blocks such as .the_content) and #imageslider.
A better fix would be to force the .the_content block to start a new block formatting context, which can be triggered by using:
.the_content {
overflow: auto;
background-color: #17C2A4;
}
If you specify the background color on .the_content in addition to or instead of on #section1, then the background color will extend all the way to the bottom edge of the #imageslider block.
Reference: http://www.w3.org/TR/CSS21/visuren.html#block-formatting
I am trying to set the post title and post excerpt to align under the date beside the featured image but I am only able to set the date but not the title and except.
This is my CSS for the date which is a simple float:
.post-thumbnail {
width: 24%;
float: left;
margin-right: 20px;
}
HTML
<div class="post-meta group">
<p class="post-category"><?php the_category(' / '); ?></p>
<p class="post-date"><?php the_time('j M, Y'); ?></p>
</div><!--/.post-meta-->
<h2 class="post-title">
<?php the_title(); ?>
</h2><!--/.post-title-->
<?php if (ot_get_option('excerpt-length') != '0'): ?>
<div class="entry excerpt">
<?php the_excerpt(); ?>
</div><!--/.entry-->
<?php endif; ?>
When I add float: left to the class .post-meta it moves the title and excerpt but not aligned under the post meta.
This is my new www.gazetbits.com. Any guide would be appreciated or would it be correct to group the title and post except into a Div and apply the float.
Thanks
The .post-meta takes too much height. I achieved your desired behavior adding this rule:
.post-meta {
height: 22px;
}
or changing the display type:
.post-meta {
display: table;
}
I'm trying to figure out how I can use nth-child to make every other instance of a div with the class "mask" change color. I have a template code that loops over and over on a page. Here it is:
<div class="view">
<?php echo get_the_post_thumbnail( $post->ID, 'clip-thumb' ); ?>
<div class="mask">
<h2><?php the_title(); ?></h2>
<p>Your Text</p>
Read More
</div>
</div>
I want all the odd instances to be one color and all the even instances to be another. This was the code I was hoping would work:
.view .mask {
width: 326px;
height: 280px;
position: absolute;
overflow: hidden;
top: 0;
left: 0
}
.view .mask:nth-child(odd) {
background-color: rgba(235,167,32, 0.7);
}
.view .mask:nth-child(even) {
background-color: rgba(4,141,195, 0.7);
}
What ends up happening, though, is that all of the masks turn one background color (the even color). This can be seen here: http://noellesnotes.com/portfolio/seventeen/
Any direction would be greatly appreciated!
Each of your .mask elements are even, in the scope of their parent (.view):
<!-- First Child (odd) -->
<div class="view">
<!-- First Child (odd) -->
<?php echo get_the_post_thumbnail( $post->ID, 'clip-thumb' ); ?>
<!-- Second Child (even) -->
<div class="mask">
<h2><?php the_title(); ?></h2>
<p>Your Text</p>
Read More
</div>
</div>
<!-- Second Child (even) -->
<div class="view">
<!-- First Child (odd) -->
<?php echo get_the_post_thumbnail( $post->ID, 'clip-thumb' ); ?>
<!-- Second Child (even) -->
<div class="mask">
<h2><?php the_title(); ?></h2>
<p>Your Text</p>
Read More
</div>
</div>
To achieve what you're after, change the following:
.view .mask:nth-child(odd) {
background-color: rgba(235,167,32, 0.7);
}
.view .mask:nth-child(even) {
background-color: rgba(4,141,195, 0.7);
}
To:
.view:nth-child(odd) .mask {
background-color: rgba(235,167,32, 0.7);
}
.view:nth-child(even) .mask {
background-color: rgba(4,141,195, 0.7);
}
I'm dynamically adding select dropdowns with jquery into a div. I would like to begin with the div centered and then as the new dropdowns are added to move out from the center outwards.
Here is the CSS for the divs:
#pageMiddle{
width:940px;
margin:0 auto;
text-align: left;
position:relative;
}
#searchBar{
background: red;
width:500px;
margin: 0 auto;
}
#searchwrapper{
width:850px;
background: blue;
}
#searchwrapper form {
display:inline ;
margin: 0 auto;
}
and the actual HTML:
<div id="pageMiddle">
<div id="holder">
<div id="searchBar">
<div id="searchwrapper">
<form name="search_input">
I am looking for a
<div id="sBar1" style="display:inline;">
<select id="search_level" class="selectSearchBar" name="search_level">
<?php echo "<option>Level</option>";
while($row = mysqli_fetch_array($result_level, MYSQLI_ASSOC)){
echo "<option value=".$row['id'].">".$row['level']."</option>";
}?>
</select>
</div>
<div id="sBar2" class="selectSearchBar"></div>
<div id="sBar3" class="selectSearchBar"></div>
tutor in
<input type=text class="searchbox" id="location" value="Location"/>
<input type=image src="images/search_icon.png " class="searchbox_submit" name="searchbox_submit" onclick="searchLocations()" value=""></form>
</div>
</div>
</div>
</div>
I assume you mean something like this?
Notice the blue section is centered in the red section. This was done with the table display, which allows something of indefinite size to be centered via automatic margins. Otherwise, it must be a block element and have a definite size.
#searchwrapper
{
display: table;
margin: 0 auto;
}
<?php echo "<option style="text-align:center;">Level</option>";
while($row = mysqli_fetch_array($result_level, MYSQLI_ASSOC)){
echo "<option value=".$row['id'].">".$row['level']."</option>";
}?>
Let me know if this works please.