1

How I can to fixed Text(for example ) in html or with css? I use this code for my own website sidebar, but when I write long text <span> Comes down in this code 12 oct 2016 comes down I use display: inline-block but this css code not avail..

.widgetbox{
	border:1px solid rgba(0,0,0,0.2);
	box-shadow:2px 2px 2px rgba(0,0,0,0.1);
	border-radius:3px;
}
.widgetbox .widgetboxTitle{
	background: rgba(0, 0, 0, 0.3);
	padding:5px 10px;
}
.widgetbox .contentarea{
	padding:7px;
	}
.widgetbox .newslist {
	margin-bottom: 15px;
}
.widgetbox .newslist img {
	border:1px solid rgba(0, 0, 0, 0.1);
	border-radius: 3px;
	float: right;
	margin: 0 0 0 5px;
}
.widgetbox .newslist h3 {
	font-size: 14px;
}
.widgetbox .newslist span{
	color: rgba(0, 0, 0, 0.4);
	display: inline-block;

}
<div class="widgetbox">
 <div class="widgetboxTitle">
 <h4>News</h4>
 </div>
 <div class="contentarea">
<div class="newslist">
 <img src="http://s9.picofile.com/file/8272330300/last_tech2.jpg" alt="ASUS">
 <h3>New Lap top</h3>
 <span>12 oct 2016</span>
</div>
   </div>
 </div>

3 Answers 3

1

Add the display: inline-block to the h3:

.widgetbox{
	border:1px solid rgba(0,0,0,0.2);
	box-shadow:2px 2px 2px rgba(0,0,0,0.1);
	border-radius:3px;
}
.widgetbox .widgetboxTitle{
	background: rgba(0, 0, 0, 0.3);
	padding:5px 10px;
}
.widgetbox .contentarea{
	padding:7px;
	}
.widgetbox .newslist {
	margin-bottom: 15px;
}
.widgetbox .newslist img {
	border:1px solid rgba(0, 0, 0, 0.1);
	border-radius: 3px;
	float: right;
	margin: 0 0 0 5px;
}
.widgetbox .newslist h3 {
	display: inline-block;
	font-size: 14px;
}
.widgetbox .newslist span{
	color: rgba(0, 0, 0, 0.4);
	display: inline-block;

}
<div class="widgetbox">
 <div class="widgetboxTitle">
 <h4>News</h4>
 </div>
 <div class="contentarea">
<div class="newslist">
 <img src="http://s9.picofile.com/file/8272330300/last_tech2.jpg" alt="ASUS">
 <h3>New Lap top</h3>
 <span>12 oct 2016</span>
</div>
   </div>
 </div>

Sign up to request clarification or add additional context in comments.

Comments

1

Just add display: inline-block; into the .widgetbox .newslist h3 class as well.

Comments

1

h3 is a block element and so the span next to it will come down.Try making that .widgetbox .newslist h3{ display:inline-block;}.Or try giving float left to both h3 and the span

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.