Here is my problem:
I need to put this number over"...".
Here is the HTML code:
<div class=" unread-object">
<div style="overflow: hidden; text-overflow: ellipsis;">
<a class="k-link nowrappable outdate-object" href="#/view/19260">
л ьотрипмасвчувсапмдгбыцячшльогтрнамам ам маугшпгнплрплроsdsds
</a>
<span class="unread-count" style="font-weight:normal; font-size:9px; color:rgb(161,187,206);float:right;">[3]</span>
</div>
</div>
float:right and left doesnt work. But, when I stretch fully slider:
use display:inline-block
<a class="k-link nowrappable outdate-object" href="#/view/19260" style="display:inline-block;">л ьотрипмасвчувсапмдгбыцячшльогтрнамам ам маугшпгнплрплроsdsds</a>
<span class="unread-count" style="font-weight:normal; font-size:9px; color:rgb(161,187,206); display:inline-block;">[3]</span>
I think this will solve your issue.
jsFiddle Link
When the width of the block does not align the two elements, the right will float line.
Simple solution is to use position:absolute;
In my example
I placed position:relative for the second div
<div style="overflow: hidden;position:relative; text-overflow: ellipsis;">
where you have content and the span with unread-count it's placed with position absolute;
.unread-object .unread-count{
position:absolute;
right:0px;
top:0px
}
Related
I know how to use text-overflow ellipsis at the when I have only want to show one line text. like this
which I simply use
<div style="height: 36px;overflow: hidden;text-overflow: ellipsis;
white-space: nowrap;
width: 246px;
">
<a>Kesong Xie: </a>
<span class="">This place i have been to before, and it has a nice sunset and a beautiful beach :)</span>
</div>
However, the text get truncated when it reaches the end of the first line, while the outside container still gets plenty of space , what I want is something like this:
It's possible to do this?
You can use some trickery with the ::after pseudo element
.clip-text{
position: relative;
}
.clip-text::after{
position:absolute;
right:-1px;
bottom:0;
content:"..."
}
<div class="clip-text" style="height: 36px;overflow: hidden;text-overflow: ellipsis;
width: 246px;
">
<a>Kesong Xie: </a>
<span class="">This place i have been to before, and it has a nice sunset and a beautiful beach :)</span>
</div>
No, this is not possible with CSS. You will have to split the lines into different elements, or use Javascript to achieve that.
Hi having some issues here trying to stack image and text on the same line left to right.
<div style="position: absolute; top: 200px; left: 30px;">
<span style="float: left;">
<img class="tglbtn" src="img/toggle_tab_l.png" data-swap='img/toggle_tab_r.png' height="60%" width="60%">
</span>
<p style="float: right; font-size: 20px; color: #92d6f8; overflow: hidden; text-align: left">
Remember User ID?
</p>
</div>
Your Code
http://jsfiddle.net/21Ltsbeb/
Improved
http://jsfiddle.net/21Ltsbeb/1/
I'm not seeing the issue? Though, you might be better off using display:inline-block with matching html elements. Inline as in Have these elements in the same line
.tglbtn {width:60%;height:60%;}
span {display:inline-block;}
p {font-size:20px;color:#92d6f8;overflow:hidden;text-align:left;}
<div>
<span>
<img class="tglbtn" src="http://www.placehold.it/66x66">
</span>
<span>
Remember User ID?
</span>
</div>
Edit
A few things I should note that you need to address as a beginner.
Don't use inline css
Don't use pixels (rem,em,or %)
Avoiding using position absolute
Don't use floats
Remember that good web applications have great continuity in their structure.
Until you get the hang of CSS, I might recommend Foundation's CSS or Bootstrap CSS.
This could be cleaned up a lot for you, and also simplifying your css/removing a lot of the inline styling:
.mind{
display:inline-block;
vertical-align:top;
}
.tglbtn{
height:20px;
}
<div class="wrap">
<img class="tglbtn" src="http://placekitten.com/g/200/300" data-swap='img/toggle_tab_r.png' />
<div class="mind">Remember User ID?</div>
</div>
Set the paragraphs top margin to 0
margin-top:0;
It's being set by the browser default otherwise (I see the mis-alignment in chrome).
See this fixed Example
I want to know if possible, how to aling on a same line the containing 'Quality Analyst', 'Celestica Sdn Bhd' and 'MYR 2xxx' without changing HTML
html :
<div class="colMiddle resume-detail-item-middle">
<div class="pageRow resume-detail-position long-text-word">Quality Analyst</div>
<div class="pageRow resume-company-location long-text-word">Celestica (AMS) Sdn. Bhd.</div>
<div class="pageRow resume-detail-item-inner resume-margin">
<div class="resume-detail-item-inner-left resume-summary-heading resume-label">Monthly Salary</div>
<div class="resume-detail-item-inner-middle resume-summary-heading">MYR 2,515</div>
... missing html
In a more clearer way :
<div class="outter-containement">
<div class="inner-content-1">inner-content-1</div>
<div class="inner-content-2">inner-content-2</div>
<div class="inner-content-3">
<div class="sub-inner-content-3-1">sub-inner-content-3-1</div>
<div class="sub-inner-content-3-2">sub-inner-content-3-2</div>
</div>
</div>
How can i align on a single line inner-content-1, inner-content-2 and sub-inner-content-3-2
http://jsfiddle.net/K58S2/14/
I would recommend changing the HTML like so: http://jsfiddle.net/K58S2/11/
However you said without changing the HTML, so here is a CSS answer: http://jsfiddle.net/K58S2/7/
.resume-detail-position, .resume-company-location{
float:left;
width:auto;
clear:none;
margin-right:7px;
}
.resume-company-location{
margin-top:1px;
}
You can use display:inline; to each div that's needs to be in line.
A better bet would be throw them in spans, like so:
<span> CONTENT </span>
<span> CONTENT </span>
<span> CONTENT </span>
However, if you insist on aligning divs, something like this would suffice:
<style type="text/css">
.example { float:left; }
</style>
<div class="example"> CONTENT </div>
<div class="example"> CONTENT </div>
<div class="example"> CONTENT </div>
The way i undersood your question, you will have to add a margin-right: to the outter container, the same width reserved of the container for 'MYR 2xxx'. Then, position:absolute; right:0; your container for 'MYR 2xxx', it will fit in.
For making your dividers aligned on a row, you will have to study your css and re-design it, because actually, your dividers take 100% width and clear:both; so you will have to manage all this because even if you attempt to float:left the containers, it won't work.
So, a short answer, yes you can do it with only .css. But be prepared for tricky css re-writing/overwriting.
An other aproach would be javascript, by removing your 'MYR 2xxx' container and replacing it in the normal flow, after 'Celestica Sdn Bhd'. For that approach, study jquery .detatch(), .append(), .appendTo() and insertAfter().
It would look like jsFiddled here :
$('.resume-detail-item-inner-middle.resume-summary-heading').insertAfter($('.pageRow.resume-company-location.long-text-word') );
But still you will have to rework your css.
Try adding the style property display:inline-block; to all three classes
For example:
.colMiddle {
display: inline-block;
}
I have the following html and css
<div id="car-76" class="thumbnail_car thumbnail span2">
<div class="thumbnail_creator">
<hr>
<div class="creator_img">
<img alt="Bob Smith" height="40x40" src="http://www.gravatar.com/avatar/df61dcc6eec08cb7d62f1959b89ae843?s=40&d=identicon&r=PG" width="40x40">
</div>
<div class="creator_details"> <a href="/users/2" title="John Malkovitchlongname the 3rd">
John Malkovitchlongname the 3rd
</a>
</div>
<div class="creator_followers"> <i class=" icon-eye-open" title="Followers"> </i> 0</div>
<div class="thumbnail_follow" id="follow_btn-2"> <a class="btn btn-primary" data-method="post" data-remote="true" rel="nofollow">Follow</a>
</div>
</div>
</div>
the relevant css is
.thumbnail_creator .creator_details {
display: inline-block;
font-size: 77%;
position: absolute;
left: 44px;
overflow: hidden;
text-overflow: clip;
}
I'd like long names to be cut if it reaches the end of the div, and not enter a new line
and for some reason doing overflow: hidden to hide the text and text-overflow: clip to clip the text won't do anything
so, instead of:
I want it to be (after editting the name to achieve the results)
fiddle here
You could try adding:
white-space:nowrap;
and setting some width on the content, since you have a fixed thumbnail width, this shouldn't be an issue, right?
see DEMO
Hope it helps ^_^
Update:
before I missed your fiddle, so I made the one for my demo. Here is a demo with your fiddle updated. Here I also added allipsis to check out =)
Also try and set the max-width css property of the .thumbnail_creator .creator_details divs.
I want different menu items in different corners having a simple hover effect. Following code is working. But only right-bottom menu item is not giving proper effect in IE6 and IE7. Whats wrong?
Here is the fiddle.
CSS:
.d
{
height:50px;
width:50px;
background-color:#b2b2b2;
position:fixed !important;
*position: absolute;
}
.da {position:absolute;}
#d1 {left:0; top:0;}
#d2 {right:0; top:0;}
#d3 {right:0; bottom:0;}
#d4 {left:0; bottom:0;}
#d1a {bottom:0; right:0;}
#d2a {bottom:0; left:0;}
#d3a {top:0; left:0;}
#d4a {top:0; right:0;}
#d1a:hover {right:-5px; bottom:-5px;}
#d2a:hover {bottom:-5px; left:-5px;}
#d3a:hover {top:-5px; left:-5px;}
#d4a:hover {top:-5px; right:-5px;}
HTML:
<div class="d" id="d1">
<a class="da" href="#" id="d1a"><img src="images/contact.png" /></a>
</div>
<div class="d" id="d2">
<a class="da" href="#" id="d2a"><img src="images/contact.png" /></a>
</div>
<div class="d" id="d3">
<a class="da" href="#" id="d3a"><img src="images/contact.png" /></a>
</div>
<div class="d" id="d4">
<a class="da" href="#" id="d4a"><img src="images/contact.png" /></a>
</div>
IE6 and IE7 are having a hard time with the negative numbers for some reason on the BR.
Strangely enough, if you remove the #d3a {top:0; left:0} css rule, (That should be its default position anyway) the problem goes away. In fact, if you play with it...any value other than top:0, left:0 allows the browser to properly determine the hover position of the #d3a div.
Further experimentation with !important on the #d3a:hover rule will help support that this is not an issue with css applying correctly, but rather, with the browser's ability to render position correctly. (That is to say that the css style is applying...but having no effect.)
I have found following solutions for the problem:
1) to add visibility:hidden to #d3a:hover block
or
2) to add margin-left:0% to #d3a:hover block
both solutions will make the code running properly in IE6 and IE7. (Even it is working with IE5.5 too)