Positioning text in different CSS shapes - html

Unfortunately I’m going slightly mad trying to align the “date” numbers over the CSS shapes. The problem I have is I would prefer a “universal” CSS number format for simplicity (the date is a displayed variable with a class applied to the td). I then change the CSS class for the underlying cell shape depending on its state to give it a background. All the PHP works to output the thing but some of the numbers align central to the cell, others are too low in the cell (mid height bottom) and two of them are off the page on at the top.
This is where I am up to (very simplified but illustrates the alignment problem in a table) – JSFiddle http://jsfiddle.net/xLWCH/
.daynumber {font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#000000; font-weight: bold; position:absolute; display: table-cell; width:20px; vertical-align:middle; top:-9px; text-align: center; vertical-align: middle;}
.halfdaystart {position:relative; border-top: 20px solid green; border-right:20px solid red; font-size:0; line-height:0; width:0;}
.halfdayend {position:relative; border-top: 20px solid red; border-right:20px solid green; font-size:0; line-height:0; width:0;}
.booked {width:20px; height:20px; background:red;}
.Prohalfdaystart {position:relative; border-top:20px solid green; border-right:20px solid yellow; font-size:0; line-height:0; width:0;}
.Prohalfdayend {position:relative; border-top: 20px solid yellow; border-right:20px solid green;font-size:0; line-height:0; width:0;}
.Profree {width:20px; height:20px; background:yellow;}
.SBhalfdaystart {position:relative; border-top:20px solid red; border-right:20px solid green; width:0; height:0;}
.SBhalfdaystart:before {content: ''; display:block; position:relative; background:lightblue; height:5px; width:20px; top:-20px;}
.SBhalfdayend {position:relative; border-top:20px solid green; border-right:20px solid red; width:0; height:0;}
.SBhalfdayend:before { content: ''; display:block; position:relative; background:lightblue; height:5px; width:20px; top:-20px;}
.free {position:relative; width:20px; height:20px; background:green;}
.SBfree {position:relative; border-top:20px solid green; border-right:20px solid green; width:0; height:0;}
.SBfree:before { content: ''; display:block; position:absolute; background:lightblue; height:5px; width:20px; top:-20px;}
<table width="20" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Halfdaystart
<div class='halfdaystart'> <!-- or other corresponding class above -->
<table width="100%" cellpadding=0 cellspacing=0 border=0>
<tr>
<td align=center class="daynumber">1</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
What is the best way to do this? Can it be done with a one size fits all CSS or will I have to create a separate class for the text (applied to the td) as well depending on what I want to display as the div class that controls the shape? Basically is there a quick and easy way to do this?

Related

Making a footer for a div element

so i want to make this footer style :
I tried my best, and i got this :
How can i make it combine like the first picture?
I've tried my best and this is my code so far :
div.code-div{
border:solid 1px #bababa;
border-radius:5px;
padding:5px;
font-family:Code;
font-size:5em;
border-bottom: solid 50px #b0b0b0;
}
div.code-div ::selection{
background-color:#adddff;
}
div.footer{
background:#b0b0b0;
border-top: solid 1px #b0b0b0;
border:solid 1px #b0b0b0;
}
b.footertext{
font-size:20%;
}
a.viewraw{
float:right;
font-size:20%;
}
table.code{
overflow-x:scroll;
display:block;
width:100%
}
td.linenum{
font-family:Code;
float:right;
margin-right:10px;
font-size:10px;
color:#bababa;
user-select: none;
}
td.linecode{
font-family:Code;
font-size:10px;
}
span.builtins.import{
color:#ffa938;
}
<link rel="stylesheet" href="0embed.css">
<div class="code-div">
<div>
<table class="code">
<tr>
<td class="linenum">1</td>
<td class="linecode"><span class="none"><span class="builtins import">import</span> PySimpleGUI <span class="builtins import">as</span> sg</span></td>
</table>
</div>
<div class="footer">
<b class="footertext">Exampletext</b>
<a class="viewraw">view raw</a>
</div>
</div>
The problem is that the text, as in the 2nd picture doesn't combine with the border, how am i supposed to combine them?
I Really Appreciate If You Help!
The problem is that you have padding on your .code-div and the .footer is inside that so won't go all the way to the edges. To make it work how you want, you should remove the padding from .code-div and add it to the .footer.
div.code-div{
border:solid 1px #bababa;
border-radius:5px;
font-family:Code;
font-size:5em;
border-bottom: solid 50px #b0b0b0;
}
div.footer{
background:#b0b0b0;
border-top: solid 1px #b0b0b0;
border:solid 1px #b0b0b0;
padding:5px;
}

Html Table moving when displaying a glyphicon when hovered on Div

I'm trying to display a glyphicon in a table row when a div is hovered. I'm able to implement it but the whole table is moving somewhat left when hovered.
This is happening only because of the styling I used.
The working code: https://jsfiddle.net/nvarun123/DTcHh/22806/
html code:
<div id="container">
<div class="heading">
Section Heading
</div>
<table align="center" >
<tr>
<td id="label" align="right">Name:</td>
<td id="field" align="left"><a >Miachel Jackson<span style="padding-left:8px;padding-right:8px;" class="glyphicon glyphicon-pencil" id="test"></span></a><td>
</tr>
<tr>
<td id="label" align="right">Net Worth:</td>
<td id="field" align="left">$500 Million</td>
</tr>
<tr>
<td id="label" align="right">Place:</td>
<td id="field" align="left">Los Angels</td>
</tr>
</table>
</div>
CSS code:
#container{
border: 1px solid #E3E3E3;
border-radius:3px;
background-color:#E3E3E3;
padding:10px;
min-width:70%;
}
.heading{
font-family:sans-serif;
font-size:18px;
color:#33434e;
padding:15px;
}
table{
border: 1px solid white;
}
tr{
border:2px solid #E3E3E3;
}
td{
padding:12px;
padding-left:8px;
padding-right:8px;
padding-top:5px;
padding-bottom:5px;
}
#label{
font-family:sans-serif;
font-size:15px;
color:#546A79;
font-weight: bold;
text-align:right;
}
#field{
font-family:sans-serif;
font-size:15px;
color:#546A79;
font-weight: normal;
height:30px;
padding-left:12px;
cursor:pointer;
}
#container:hover #field{
background-color: #E4EBF1;
}
#container:hover #field:hover{
background-color:#7F96A3;
}
#container #test{
display:none;
}
#container:hover #test{
display:inline;
}
#field:hover #test{
color:white;
}
#field:hover{
color:#FFF;
}
a{
color:#546A79;
text-decoration:none;
}
#field:hover a{
color:#FFF;
text-decoration:none;
}
Please tell me where I'm going wrong.
To achieved expected result, use below
#container #test{
visibility:hidden;
}
#container:hover #test{
visibility:visible;
}
https://jsfiddle.net/Nagasai_Aytha/DTcHh/22810/
display:none, doesn't occupy space , so when display:inline is available on hover, creates extra space which shifts table.
visibility :hidden ,hides the glyphicon and occupies element space

Cannot push dd over to the left

Still a CSS newbie, not quite sure what to do
I am having difficulty getting my dd elements to line up directly next to their respective dt elements. They seem to align far to the right and I'd like to be able to control their width span from position with 0 px
Here is an image of the resulting HTML:
If you look the blue boxes are lined up far to the right
Here is my HTML:
<div id="reviews">
<table cellpadding="0" cellspacing="0">
<tr class="reviewuserinfo">
<td width="1%"><img class="avatar" src="/avatar/35274"/></td>
<td>Traveler<br/>posted on 15 May, 2008</td>
<td align="right" style="padding-right:15px">Joined 2 years ago<br/>12 reviews and 49 comments posted</td>
</tr>
<tr class="reviewuserdata">
<td style="width:100%" colspan="3">
<table cellpadding="0" cellspacing="0" class="reviewchart">
<tr><td><h2>Overall Rating <img class="stars" src="/stars/3.9/large" /> <span class="rating">4.5</span></h2></td></tr>
<tr>
<td>
<dl>
<dt><span>QUALITY OF THE DANCERS</span></dt>
<dd><div class="bar"><div style="width:100%"></div></div></dd>
<dt><span>PRIVATE DANCES, VALUE FOR MONEY</span></dt>
<dd><div class="bar"><div style="width:100%"></div></div></dd>
<dt><span>OVERALL HOSPITALITY</span></dt>
<dd><div class="bar"><div style="width:100%"></div></div></dd>
<dt><span>GUEST TO DANCER RATIO</span></dt>
<dd><div class="bar"><div style="width:100%"></div></div></dd>
<dt><span>VARIETY OF DANCERS</span></dt>
<dd><div class="bar"><div style="width:100%"></div></div></dd>
<dt><span>VALUE FOR MONEY, COVER CHARGE</span></dt>
<dd><div class="bar"><div style="width:100%"></div></div></dd>
<dt><span>VALUE FOR MONEY, DRINKS</span></dt>
<dd><div class="bar"><div style="width:100%"></div></div></dd>
<dt><span>VALUE FOR MONEY, FOOD</span></dt>
<dd><div class="bar"><div style="width:100%"></div></div></dd>
<dt><span>OVERALL ATMOSPHERE</span></dt>
<dd><div class="bar"><div style="width:100%"></div></div></dd>
<dt><span>SOUND SYSTEM AND DJ</span></dt>
<dd><div class="bar"><div style="width:100%"></div></div></dd>
</dl>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
And here is my CSS:
#CHARSET "UTF-8";
.page {
position: relative;
background-color: #ffffff;
width: 1200px;
margin: 0px auto;
box-sizing: border-box;
border-left: 1px solid #d0d0d0;
border-right: 1px solid #d0d0d0;
}
table {
border:0px;
width:100%
}
table.reviewsouter .reviewleft{
width:800px
}
table.reviewsouter .reviewright{
width:400px
}
#reviewspotlight {
position: relative;
background-color:#000000;
height:111px;
z-index:19997;
font-family: DinWebCond, Sans-serif;
color:#ffffff;
}
#reviews {
position: relative;
background-color:#ffffff;
color:#000000;
border-right:1px solid #d0d0d0;
}
#reviews table tr.reviewuserinfo {
background-color:#f0f0f0;
height:60px;
border-left:1px solid #d0d0d0;
}
#reviews table tr.reviewuserinfo img.avatar{
position:relative;
width:40px;
height:40px;
margin:10px;
display: inline-block;
vertical-align: middle;
}
#reviews table tr.reviewuserinfo div {
display:block
}
#reviews table tr.reviewuserdata {
background-color:#ffffff;
height: 315px;
border-left:1px solid #ffffff;
vertical-align: top;
}
#reviews table td h2 {
position:relative;
display:inline-block;
white-space:nowrap;
font:24px/24px DinWebCond,Sans-serif;
margin:0px;
text-transform:uppercase;
/**padding:20px 0px 9px 15px;*/
/**padding-top:20px;*/
/**padding-left:20px;*/
}
#reviews table td h2 img.stars {
position:absolute;
margin-left:10px;
display:inline-block;
}
#reviews table td h2 span.rating{
position:absolute;
margin-left:145px;
display:inline-block;
color:#e85a06;
font-weight:bold;
}
table.reviewchart {
position:relative;
display:inline-block;
white-space:nowrap;
border-collapse: collapse;
font:14px/14px DinWebCond,Sans-serif;
margin:0px;
text-transform:uppercase;
/**padding:20px 0px 9px 15px;*/
padding-top:20px;
padding-left:20px;
}
table.reviewchart td.reviewlabel{
/**padding-top:15px;*/
padding-bottom:15px;
}
#reviews.dl {
position:relative;
margin: 15px 15px 15px 15px;
}
#reviews dt {
position:relative;
display:inline-block;
float:left;
width:300px;
/**text-align:right;*/
pointer-events:none;
margin:0px;
padding:3px 0px 2px 0px;
z-index:2;
}
#reviews dd {
position:relative;
display:block;
margin:0px;
padding:3px 0px 2px 0px;
z-index:1
}
#reviews dd .bar {
position:relative;
display:inline-block;
width:150px;
height:15px;
margin:1px 20px -1px 20px;
}
#reviews dd .bar div {
position:absolute;
left:0px;
top:0px;
height:100%;
background-color:#1f73b3;
border-top-right-radius:3px;
border-bottom-right-radius:3px;
}
If you want the blue bars to be positioned right beside the text, like this:
Then one option is to float the dt and dd elements, like this:
#reviews dt {
float: left;
clear: both;
}
#reviews dd {
float: left;
}
If you then want to control the spacing, like this:
Add a fixed width to your dt elements:
#reviews dt {
width: 260px;
}
If you don't want the text labels to wrap onto two lines and it isn't possible for you to know how wide the longest label will be, then I suggest converting your dl into a table and placing the labels and blue bars in separate table cells.
You have a width of 300px set for #reviews dt. If you remove that, they are no longer to the right.

img and text vertical align

<div class="card">
<img class='sound' src='https://www.google.com/images/srpr/logo4w.png'>
<div class='txt'>
this is a sentence.this is a sentencethis is a sentence.
</div></div>
.card{
margin:5px 14px;
border:thin solid blue;
}
.sound{
width:32px;
height:32px;
cursor:pointer;
}
.txt{
display:inline-block;
margin-left:25px;
vertical-align:middle; //doesn't work
border:thin solid red;
}
How can I align .txt div to be on the middle of .sound image ?
fiddle is here
Put vertical-align on .sound?
.card{
margin:5px 14px;
border:thin solid blue;
}
.sound{
width:32px;
height:32px;
cursor:pointer;
vertical-align:middle;
}
.txt{
display:inline-block;
margin-left:25px;
border:thin solid red;
}
http://jsfiddle.net/hWejY/1/
Insert vertical-align: middle into class sound
.card{
margin:5px 14px;
border:thin solid blue;
}
.sound{
width:32px;
height:32px;
cursor:pointer;
vertical-align:middle
}
.txt{
display:inline-block;
margin-left:25px;
vertical-align:middle;
border:thin solid red;
}
DEMO
vertical-align:middle;
Should be on .sound

border collapse and border bottom

Hi
mine css class is as below for table records
table.tblBaseTblData{
margin:0px;
padding:0px;
*margin-left:10px;
*margin-left:0px;
border-bottom:1px solid #003366;
border-collapse:collapse;
}
table.tblBaseTblData th{
font-family:Arial,Verdana;
font-size:10px;
font-weight:bold;
background-color:#003366;
color:#F4EFEC;
height:25px;
margin:0px;
border:1px solid #003366;
}
table.tblBaseTblData td{
font-family:Arial,Verdana;
font-size:10px;
font-weight:normal;
color:#000000;
padding:2px 2px 2px 2px;
height:15px;
border:1px solid #003366;
}
table.tblBaseTblData .oddRow{
background-color:#DDDDDD;
}
table.tblBaseTblData .evenRow{
background-color:#FFFFFF;
}
when add additional css like below table border getting hidden
table>tbody {
overflow: auto;
height: 280px;
overflow-x: hidden;
}
table>tbody tr {
height: auto;
}
table>thead tr {
position:relative;
top: 0px;/*expression(offsetParent.scrollTop); IE5+ only*/
}
what will be solution for this happens only in mozilla not in IE
In the section table.tblBaseTblData you have two different margin-lefts. Take one out.