I have some text in a table cell in a table row that I'm trying to have the text span.
The text keeps on stopping in place.
This is what I currently have:
However this is what I want:
I want the text to span all way.
How would I implement this?
This is my code:
.normal-cell-styling-left-second {
width: 350px;
padding-top: 20px;
padding-bottom: 20px;
border-bottom: 1px solid #E6E6E6;
}
.normal-cell-styling-middle-second {
width: 425px;
padding-left: 60px;
padding-top: 20px;
padding-bottom: 20px;
border-bottom: 1px solid #E6E6E6;
}
.normal-cell-styling-right-second {
width: 700px;
padding-top: 20px;
padding-left: 200px;
padding-bottom: 20px;
border-bottom: 1px solid #E6E6E6;
}
.gray-dynamic {
display: inline-block;
background-color: #F6F8FA;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 5px;
padding-right: 5px;
border-radius: 4px;
margin-top: 5px;
margin-bottom: 5px;
font-weight: normal;
font-size: 16px;
font-family: 'PureHeadlineRegular', Sans-serif;
line-height: 19px;
color: #212121;
}
.image-placeholder5 {
display: inline-block;
width: 196px;
height: 36px;
background-color: #F1F1F1;
}
<table>
<tr>
<td className="normal-cell-styling-left-second">
<span class="gray-dynamic">
SHADOW_SPREAD_0
</span>
</td>
<td className="normal-cell-styling-middle-second">
0 0 0px 0 rgba(0,0,0,0.12) <br></br>0 0px 0px 0 rgba(0,0,0,0.24)
</td>
<td className="normal-cell-styling-right-second">
<div className="image-placeholder5"></div>
</td>
</tr>
<table>
Just put it in a span like your SHADOW_SPREAD
.normal-cell-styling-left-second {
width: 350px;
padding-top: 20px;
padding-bottom: 20px;
border-bottom: 1px solid #E6E6E6;
}
.normal-cell-styling-middle-second {
width: 425px;
padding-left: 60px;
padding-top: 20px;
padding-bottom: 20px;
border-bottom: 1px solid #E6E6E6;
}
.normal-cell-styling-right-second {
width: 700px;
padding-top: 20px;
padding-left: 200px;
padding-bottom: 20px;
border-bottom: 1px solid #E6E6E6;
}
.gray-dynamic {
display: inline-block;
background-color: #F6F8FA;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 5px;
padding-right: 5px;
border-radius: 4px;
margin-top: 5px;
margin-bottom: 5px;
font-weight: normal;
font-size: 16px;
font-family: 'PureHeadlineRegular', Sans-serif;
line-height: 19px;
color: #212121;
}
.image-placeholder5 {
display: inline-block;
width: 196px;
height: 36px;
background-color: #F1F1F1;
}
<table>
<tr>
<td className="normal-cell-styling-left-second">
<span class="gray-dynamic">
SHADOW_SPREAD_0
</span>
</td>
<td className="normal-cell-styling-middle-second">
<span class="gray-dynamic">
0 0 0px 0 rgba(0,0,0,0.12) <br>0 0px 0px 0 rgba(0,0,0,0.24)
</span>
</td>
<td className="normal-cell-styling-right-second">
<div className="image-placeholder5"></div>
</td>
</tr>
<table>
Modify the css
.table thead tr th td {
white-space:nowrap
}
Then use white-space-no-wrap in the table data style
<td style="white-space:nowrap;" className="normal-cell-styling-middle-second"> 0 0 0px 0 rgba(0,0,0,0.12) <br></br>0 0px 0px 0 rgba(0,0,0,0.24) </td>
Not sure, but it looks like there is a few things about table styling you are not familiar with :
vertical-align can be used on a cell to tell if the content is to centered, aligned on top or bottom without using padding or line-height for an average alignment. https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align (look farther down about table cells )
border-collapse or border-spacing can be used to avoid gaps in between cells border. see https://developer.mozilla.org/en-US/docs/Web/CSS/border-collapse & https://developer.mozilla.org/en-US/docs/Web/CSS/border-spacing might look similar but involves different behavior when drawing borders on a table.
table-layout:fixed can be used to set a fixed width to the table and the cells so they do not shrink/expand anymore. ( height cannot be set on a fixed value, table will not show scrollbars) this is the one thing to know about the table (or display:table / table-cell / ... properties) rendering behavior.
white-space can be used anywhere and you might know more about it https://developer.mozilla.org/en-US/docs/Web/CSS/white-space
Here is a snippet that could be closer to what you expect, do not hesitate to clarify your needs and misunderstandings of myself.
table{
border-spacing:0;/* or border-collapse:collapse; */
}
.normal-cell-styling-left-second {
width: 350px;
border-bottom: 1px solid ;
vertical-align:top;
}
.normal-cell-styling-middle-second {
width: 425px;
padding-left: 60px;/* needed ?*/
border-bottom: 1px solid ;
white-space:nowrap;
}
.normal-cell-styling-right-second {
border-bottom: 1px solid ;
}
.gray-dynamic {
display: inline-block;
background-color: #F6F8FA;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 5px;
padding-right: 5px;
border-radius: 4px;
margin-top: 5px;
margin-bottom: 5px;
font-weight: normal;
font-size: 16px;
font-family: 'PureHeadlineRegular', Sans-serif;
line-height: 19px;
color: #212121;
}
.image-placeholder5 {
display: inline-block;
width: 196px;
height: 36px;
background-color: #F1F1F1;
}
<table>
<tr>
<td class="normal-cell-styling-left-second">
<span class="gray-dynamic">
SHADOW_SPREAD_0
</span>
</td>
<td class="normal-cell-styling-middle-second">
0 0 0px 0 rgba(0,0,0,0.12) <br>0 0px 0px 0 rgba(0,0,0,0.24)
</td>
<td class="normal-cell-styling-right-second">
<div class="image-placeholder5"></div>
</td>
</tr>
<table>
Related
.score{
font-size: 20px;
text-align: center;
background-color: white;
width: 700px;
height: 200px;
border: 1px solid white;
border-radius: 0px 0px 10px 10px;
display: block;
margin: 0 auto;
}
.score p span{
padding-top: 100px;
}
<div class="score">
<p>bb<span id="correctAns">jkjh </span></p>
</div>
I want to move my text down a little bit but it's not working, putting padding in .score just makes it bigger and nothing happens if I put it in .score p span.
Nepotech's answer is correct. An other way is useing line-height for .score:
.score {
font-size: 20px;
text-align: center;
background-color: white;
width: 700px;
height: 200px;
border: 1px solid white;
border-radius: 0px 0px 10px 10px;
display: block;
line-height: 100px;
}
<div class="score">
<p>bb<span id="correctAns">jkjh </span></p>
</div>
Just Use margin-top to p element
Note: I have changed color to blue, for better understanding!
.score{
font-size: 20px;
text-align: center;
background-color: blue;
width: 700px;
height: 200px;
border: 1px solid white;
border-radius: 0px 0px 10px 10px;
display: block;
margin: 0 auto;
}
p{
margin-top: 100px;
}
<div class="score">
<p>bb<span id="correctAns">jkjh </span></p>
</div>
I need to create a table with two columns and the first column, the cells only have a bottom border, where the cells in the second column have borders all around with round corner for the top and bottom.
My code looks like this, and work in Explorer, but in Firefox and Chrome it gives me round corner border plus normal corners:
table {
border-collapse: collapse;
width: 50%;
font-family: Proxima Nova, Arial;
}
.h1 {
/*Head cell red*/
text-align: center;
border: 1px solid #D81541;
border-radius: 20px 20px 0px 0px;
background-color: #D81541;
color: white;
font-size: 1.5em;
font-weight: bold;
width: 60%;
}
.td1 {
/*right column cells*/
border: 1px solid #6D6E70;
text-align: left;
width: 60%;
}
.td2 {
/*left column cells bold*/
border-bottom: 1px solid #6D6E70;
font-weight: bold;
vertical-align: top;
}
.td3 {
/*last cell right column*/
border: 1px solid #6D6E70;
border-radius: 0px 0px 20px 20px;
text-align: left;
width: 60%;
}
.td4 {
/*last cell left column*/
vertical-align: top;
font-weight: bold;
}
<table>
<tr>
<td class="td2"></td>
<td class="h1">My top corners should be round</td>
</tr>
<tr>
<td class="td2">bla</td>
<td class="td1">blabla</td>
</tr>
<tr>
<td class="td4">last row</td>
<td class="td3">my bottom corners should be round</td>
</tr>
</table>
Just remove border-collapse: collapse; from .table & add border-spacing:0 to it
Check the snippet. with thanks to #Abhitalks for his previous fiddle.
table {
border-spacing: 0;
width: 50%;
font-family: Proxima Nova, Arial;
}
.h1 {
/*Head cell red*/
text-align: center;
border: 1px solid #D81541;
border-radius: 20px 20px 0px 0px;
background-color: #D81541;
color: white;
font-size: 1.5em;
font-weight: bold;
width: 60%;
}
.td1 {
/*right column cells*/
border: 1px solid #6D6E70;
text-align: left;
width: 60%;
}
.td2 {
/*left column cells bold*/
border-bottom: 1px solid #6D6E70;
border-top: 1px solid #6D6E70;
font-weight: bold;
vertical-align: top;
}
.td3 {
/*last cell right column*/
border: 1px solid #6D6E70;
border-radius: 0px 0px 20px 20px;
text-align: left;
width: 60%;
}
.td4 {
/*last cell left column*/
vertical-align: top;
font-weight: bold;
border-top: 1px solid #6D6E70;
}
.td5 {
/*left column first cells*/
border-bottom: 1px solid #6D6E70;
font-weight: bold;
vertical-align: top;
}
<table>
<tr>
<td class="td5"></td>
<td class="h1">My top corners should be round</td>
</tr>
<tr>
<td class="td2">bla</td>
<td class="td1">blabla</td>
</tr>
<tr>
<td class="td4">last row</td>
<td class="td3">my bottom corners should be round</td>
</tr>
</table>
Have you tried this?
td
{
border-radious:0px;
}
I have an image icon inside my input, that's working fine.
The problem is that the icon is pushing my other input down. As you can see, after fade out, the input come back to desired position.
Is this a CSS issue? How can I solve this?
$("img#input_img").fadeOut(3000);
.input-test {
display: block;
margin: 0 20px;
width: 200px;
height: 34px;
box-sizing: border-box;
border: 2px solid green;
border-radius: 4px;
font-size: 16px;
color: black;
padding: 12px 20px 12px 10px;
height: 20px;
padding-right: 30px;
}
input {
display: block;
margin: 0 20px;
width: 200px;
height: 34px;
box-sizing: border-box;
border: 2px solid green;
border-radius: 4px;
font-size: 16px;
color: black;
padding: 12px 20px 12px 10px;
height: 20px;
padding-right: 30px;
}
#input_img {
width: 24px;
height: 24px;
position: relative;
/* adjust as you need */
left: 190px;
bottom: 27px;
}
table {
border: 1px solid red;
}
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<h2>table 1</h2>
<table>
<tr>
<td id="input_container">
<input type="text" class="input-test">
<img src="https://cdn4.iconfinder.com/data/icons/36-slim-icons/87/calender.png" id="input_img">
</td>
<td>
<input type="text" class="">
</td>
</tr>
</table>
<h2>table 2</h2>
<table>
<tr>
<td>
<input type="text" class="input-test">
</td>
<td>
<input type="text" class="">
</td>
</tr>
</table>
Follow-up to my comment about just setting the background of the input...
.input-test {
background-image: url('https://cdn4.iconfinder.com/data/icons/36-slim-icons/87/calender.png');
background-repeat: no-repeat;
background-position: 99% 48%;
background-size: 24px 24px;
}
basically, you can set the image position as absolute so that the wrapper will ignore the image height. Additionally, you have to set the wrapper position as relative so that the image position (bottom, and left) will depend on it's wrapper.
Last thing, just adjust the image position as you see fit.
I hope that makes sense for you
EDIT: to make it more clear, I only changed this much.
#input_img {
position: absolute;
/* adjust as you need */
left: 190px;
bottom: 4px;
}
table td {
position: relative;
}
$("img#input_img").fadeOut(3000);
.input-test {
display: block;
margin: 0 20px;
width: 200px;
height: 34px;
box-sizing: border-box;
border: 2px solid green;
border-radius: 4px;
font-size: 16px;
color: black;
padding: 12px 20px 12px 10px;
height: 20px;
padding-right: 30px;
}
input {
display: block;
margin: 0 20px;
width: 200px;
height: 34px;
box-sizing: border-box;
border: 2px solid green;
border-radius: 4px;
font-size: 16px;
color: black;
padding: 12px 20px 12px 10px;
height: 20px;
padding-right: 30px;
}
#input_img {
width: 24px;
height: 24px;
position: absolute;
/* adjust as you need */
left: 190px;
bottom: 4px;
}
table {
border: 1px solid red;
}
table td {
position: relative;
}
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<h2>table 1</h2>
<table>
<tr>
<td id="input_container">
<input type="text" class="input-test">
<img src="https://cdn4.iconfinder.com/data/icons/36-slim-icons/87/calender.png" id="input_img">
</td>
<td>
<input type="text" class="">
</td>
</tr>
</table>
<h2>table 2</h2>
<table>
<tr>
<td>
<input type="text" class="input-test">
</td>
<td>
<input type="text" class="">
</td>
</tr>
</table>
In table-cell the default vertical alignment is middle, you can reset that by adding:
td {
vertical-align: top;
}
It would be better to set position: absolute; on the image, so it will be out of the normal content flow, and won't affect your standard layout, also easier to control the offsets.
td {
vertical-align: top;
position: relative;
}
#input_img {
width: 24px;
height: 24px;
position: absolute;
right: 24px;
top: 2px;
}
$("img#input_img").fadeOut(3000);
.input-test {
display: block;
margin: 0 20px;
width: 200px;
height: 34px;
box-sizing: border-box;
border: 2px solid green;
border-radius: 4px;
font-size: 16px;
color: black;
padding: 12px 20px 12px 10px;
height: 20px;
padding-right: 30px;
}
input {
display: block;
margin: 0 20px;
width: 200px;
height: 34px;
box-sizing: border-box;
border: 2px solid green;
border-radius: 4px;
font-size: 16px;
color: black;
padding: 12px 20px 12px 10px;
height: 20px;
padding-right: 30px;
}
#input_img {
width: 24px;
height: 24px;
position: absolute;
right: 24px;
top: 2px;
}
table {
border: 1px solid red;
}
td {
vertical-align: top;
position: relative;
}
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<h2>table 1</h2>
<table>
<tr>
<td id="input_container">
<input type="text" class="input-test">
<img src="https://cdn4.iconfinder.com/data/icons/36-slim-icons/87/calender.png" id="input_img">
</td>
<td>
<input type="text" class="">
</td>
</tr>
</table>
<h2>table 2</h2>
<table>
<tr>
<td>
<input type="text" class="input-test">
</td>
<td>
<input type="text" class="">
</td>
</tr>
</table>
change this in your css should be work:
#input_img {
width: 24px;
height: 24px;
position: absolute;
right: 24px;
top: 2px;
}
td {
vertical-align: top;
position: relative;
}
I am implementing notifications. I have integrated the whole backend with the front end.
I have Notification HTML as :
<span id="notification_count" style="display: none"></span>
<img alt="" src="assets/img/notification-icon.jpg">
<div id="notificationContainer">
<div id="notificationTitle">Notifications</div>
<div id="notificationsBody">
<table style="text-align: center;">
<tr>
123
</tr>
<hr>
<tr>
123
</tr>
<hr>
<tr>
123
</tr>
<hr>
<tr>
123
</tr>
<hr>
<tr>
123
</tr>
<hr>
<tr>
123
</tr>
<hr>
</table>
</div>
<div id="notificationFooter"></div>
</div>
And CSS :
#nav{list-style:none;margin: 0px;padding: 0px;}
#nav li {
float: left;
margin-right: 20px;
font-size: 14px;
font-weight:bold;
}
#nav li a{color:#333333;text-decoration:none}
#nav li a:hover{color:#006699;text-decoration:none}
#notification_li
{
position:relative
}
#notificationContainer
{
background-color: #fff;
border: 1px solid rgba(100, 100, 100, .4);
-webkit-box-shadow: 0 3px 8px rgba(0, 0, 0, .25);
overflow: visible;
color : #ffffff;
position: absolute;
top: 30px;
margin-left: -170px;
width: 400px;
z-index: -1;
display: none; // Enable this after jquery implementation
}
// Popup Arrow
#notificationContainer:before {
content: '';
display: block;
position: absolute;
width: 0;
height: 0;
border: 10px solid black;
border-color: transparent transparent white;
margin-top: -20px;
margin-left: 188px;
}
#notificationTitle
{
text-align: center;
font-weight: bold;
padding: 8px;
font-size: 12px;
background-color: #ffffff;
border-bottom: 1px solid #dddddd;
color: #555;
}
#notificationsBody
{
padding: 33px 0px 0px 0px !important;
min-height:300px;
}
#notificationFooter
{
background-color: #e9eaed;
text-align: center;
font-weight: bold;
padding: 8px;
font-size: 12px;
border-top: 1px solid #dddddd;
}
#notification_count
{
padding: 3px 7px 3px 7px;
background: #cc0000;
color: #ffffff;
font-weight: bold;
margin-left: 25px;
border-radius: 9px;
-moz-border-radius: 9px;
-webkit-border-radius: 9px;
position: absolute;
margin-top: -11px;
font-size: 11px;
}
But the a tags in the notificationsBody are not working. On clicking these a tags nothing is happening.
Please tell what is the issue. There might some problem in the z index. Please help me out.
You can use onclick event to open a link
123
Your HTML is invalid and is a likely cause of your problem.
You aren't allowed to put links as children of table rows. Only table cells may go there.
Use a validator and fix the errors.
I have a text input but the color is not right on top and left border, why is this, and how can I fix this?
http://jsfiddle.net/9ehBs/
HTML
<input type="text" class="searchbox" />
CSS
.searchbox
{
width: 200px;
height: 30px;
padding: 10px;
font-size: 28px;
font-weight: 900;
font-family: Ebrima;
color: rgb(54,54,54);
border-width: 13px;
border-color: rgb(46,94,115);
float: left;
margin-left: 10px;
margin-top: 10px;
}
You need border-style: solid. See your updated fiddle.
It would be much more efficient to use the shorthand, i.e. border: 13px solid rgb(46,94,115);
border: 13px solid rgb(46,94,115);
easier in one row ... hope it helps
.searchbox
{
width: 200px;
height: 30px;
padding: 10px;
font-size: 28px;
font-weight: 900;
font-family: Ebrima;
color: rgb(54,54,54);
border-width: 13px;
border-style: solid;/* add this to your css options: dotted | solid | dashed */
border-color: rgb(46,94,115);
float: left;
margin-left: 10px;
margin-top: 10px;
}
shorthand writing:
margin: 10px 0 0 10px; /*(top, right and left, bottom)*/
border:13px solid rgb(46,94,115);
...instead of
margin-left: 10px;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;
border-width: 13px;
border-style: solid;/* add this to your css options: dotted | solid | dashed */
border-color: rgb(46,94,115);