How to make text dynamically break or going to next line? - html

I have a design like this:
You see the middle text,when it's too big it spoils my design.
here you can see
I want after a certain characters it will go down from where location started and continue.I am a noob. Please Help me.
My HTML:
<div class="title-body">
<h4 id="title"></h4>
<div class="info">
<span class="company"><i data-feather="briefcase"></i><span id="company_name"></span></span>
<span class="office-location"><a href="#"><i data-feather="map-pin"></i><span id="company_location"
style="word-break: break-all;width:14px;"></span></a></span>
<span class="job-type full-time"><a href="#"><i data-feather="clock"></i><span
id="employment_status"></span></a></span>
</div>
</div>
CSS
element.style {
word-break: break-all;
width: 14px;
}
.job-title-and-info .title .title-body .info span {
font-size: 1.4rem;
font-weight: 400;
font-family: "Roboto", sans-serif;
margin-right: 15px;
color: #6f7484;

Update your CSS to have a max-width property.
Based off what you have, you could add this block of code to your CSS file:
.office-location {
display: block;
// set this value to something that makes sense for your design.
max-width: 100px;
}

Related

How to fix the text absolutely in HTML/CSS even I minimize the screen

So right now I am trying to apply what I have learned in Front Web Development, and I have this problem where the text doesn't stay the way it should be in smaller viewports.
body {
font-family: "Roboto Condensed", sans-serif;
margin: 0;
background: #f2f2fc;
color: #302e4d;
}
.about-section {
position: absolute;
max-width: 100%;
top: 20%;
left: 40%;
transform: translate(-40%, -60%);
}
.about-me div {
font-size: 40px;
font-weight: bold;
}
.intro {
font-size: 30px;
padding-top: 50px;
font-weight: bold;
}
.intro-stud {
color: #E00;
}
.description {
color: #504e70;
font-size: 20px;
font-weight: normal;
}
<div id="main-content">
<section class="about-section">
<div class="about-me">
<div>About Me</div>
</div>
<div class="intro">
<span class="intro-name">I'm Christian Wells Martin and</span>
<span class="intro-stud">a Student</span>
<p class="description">Hi! My name is Christian Wells Martin, a BSIT/BSCS student in _____ College/University, and currently studying web development, and this website is my first mini-project, and I hope you guys will like it!.</p>
</div>
</section>
</div>
Recommendations are welcome, specially if I am doing some wrong practices.
There are a couple ways to solve this.
One, you're using percentages in your absolute positioning. Percentages will change as the size of the window changes. This can make for a nice effect, but it doesn't seem to be what you're going for. Try using exact pixel values if you don't want your text to react responsively. https://www.w3schools.com/cssref/pr_dim_width.asp
Another, more advanced way to solve this would be to use media queries. These allow you to define different css styles based on the current size of the screen. https://www.w3schools.com/cssref/css3_pr_mediaquery.asp
.about-section{
display:grid;
grid-template-rows:auto, 1fr;
}
That should solve your problem. If it is not try this one:
.about-section{
display:flex;
flex-direction:column;
}

Text with different sizes on same line, how to align smaller text horizontally central with bigger text?

As demonstrated in the above image (please take no notice of the fact the Dasboard text is abhorrently large - I only made it that size for this example), I want the text that says "Admin Control Panel" to be aligned horizontally middle with where the Dashboard text is, online with the red arrow.
The code I have for both these pieces of text are:
<div id="content-breadcrumb">
Admin Control Panel »
<span id="active">
Dashboard
</span>
</div>
The CSS code is:
#content-breadcrumb {
font-family: 'Varela Round', sans-serif
font-size: 16px;
}
#content-breadcrumb #active {
font-size: 200px;
color: #4F95C4;
}
Note that I have tried using vertical align and setting line height to no avail. Thanks for any help that you can offer!
You can use flex box and align-items to accomplish this:
(PS: your closing div and span tags are missing the right caret)
#content-breadcrumb {
display: flex;
align-items: center;
font-size: 1rem;
}
#active {
font-size: 2rem;
}
<div id="content-breadcrumb">
Admin Control Panel »
<span id="active">
Dashboard
</span>
</div>
If you dont want to use flex-box you can use vertical-align: middle;.
https://jsfiddle.net/yrduwpzm/
#content-breadcrumb {
font-family: 'Varela Round', sans-serif
font-size: 16px;
}
#content-breadcrumb #active {
font-size: 50px;
color: #4F95C4;
vertical-align: middle;
}
<div id="content-breadcrumb">
Admin Control Panel »
<span id="active">
Dashboard
</span>
</div>

HTML/CSS : Add Responsive Box+Text Over Image

I have a website www.weardenali.com. A part of the site has an image banner which I want to be overlayed by a Colored Box and some text, just like how Bellroy.com has theirs.
This is what I have, a failed code which isn't responsive :
Wear Denali (my site):
Bellroy:
This is the code i am using now :
.image-banner-content.content-left {
padding-left: 1% !important;
}
.sf-animation.image-banner-content,
.sf-animation[data-animation="none"].image-banner-content {
bottom: 80% !important;
}
a.link:hover,
a.link:active {
text-decoration: underline;
color:#F03E3E !important;
}
<div style="margin-bottom: 60%; float: left; display: inline-block; padding: 0px 10px 5px 10px; background-color: #ffffff; position: relative;">
<h3>
<span style="color: #0e3559;">
Designed by Urban Adventurers
</span>
</h3>
<h4>
<a href="http://weardenali.com/" class="link" style="color: #0e3559; float: left; font-family: 'Lato', sans-serif; -webkit-font-smoothing: antialiased; font-size: 12px; letter-spacing: 1.2px;">
> SHOP NOW
</a>
</h4>
</div>
I appreciate any advice/pointers.
Assuming your image banner was done in a kinda sorta ok way... This should work:
<!--- code for the image banner --->
<div class="MyAdvertisement">
<h3>Designed by Urban Adventurers</h3>
<a href="http://weardenali.com/">
<i class="fa fa-chevron-right" aria-hidden="true"></i>
SHOP NOW
</a>
</div>
<!--- end code for the image banner --->
Note that I added Font Awesome code for the > you had in there. Using glyphs the way you did is annoying for non-sighted users. Google Font Awesome. It's nice.
I'm not sure what you want to do exactly. I'll give you css for pixel values, but if you want responsive as is 'scales with the browser', use percentages.
.MyAdvertisement {
display: block;
position: absolute;
top: 0;
left: 0;
width: 200px;
height: auto;
overflow: hidden;
background: white;
}
If you can't put your code where I suggested, you are going to have to tell us more about your site code before anyone can help you in any meaningful way.
Good luck & have fun.

How to make text change to different text that is clickable on hover?

I need help on some HTML/CSS styling. I have a cart widget on my website that shows the items in the users cart, and it displays the item quantity, the name, the price, and a button to remove the item. This is what it looks like. Now, what I want is for it to only display the quantity, the item name, and the price on the far right, and I want the word "remove" to appear whenever the user hovers over the item, replacing the price on the far right. So, I want there to normally be just the quantity, the name of the item, and the price. When the user hovers over the cart item, I want the price to be replaced with the word "remove". Here's the html of the widget:
<div id="modal" style="width: auto; height: auto; top: 178px; left: 542.5px; display: block;"><div id="content">
<!--dynamic-cached-content-->
<li class="cart_item empty" style="display: none;"><span class="edd_empty_cart">Your cart is empty.</span></li>
<li class="edd-cart-item">
<span class="edd-cart-item-quantity"> 1 </span><span class="edd-cart-item-separator"> - </span><span class="edd-cart-item-title">The Grant</span>
<span class="edd-cart-item-price"> $2.00 </span><span class="edd-cart-item-separator">-</span>
remove
</li>
<li class="cart_item edd-cart-meta edd_total" style="">Total: <span class="cart-total">$2.00</span></li>
<li class="cart_item edd_checkout" style="">Checkout</li>
<!--/dynamic-cached-content-->
</div><a id="modal-close" href="#"><i class="fa fa-times-circle-o"></i></a>
</div>
And here's the CSS that I have:
body,
button,
input,
textarea {
color: #55b6fb;
font-family: 'Lato', sans-serif;
font-style: normal;
font-weight: 400;
font-size: 16px;
font-size: 1.6rem;
line-height: 1.75;
word-wrap: break-word;
-webkit-font-smoothing: antialiased;
}
And for the remove button:
a.edd-remove-from-cart {
color: #666;
}
a.edd-remove-from-cart:hover {
color: #e56363;
}
I'm sorry if this isn't enough information. If you need more CSS or HTML, tell me what you need and I can copy and paste it. Thank you all so much!
For this type of question, it's best to provide a live example.
I suspect you can do this pretty easily with CSS :hover pseudo class.
You may find help on easy digital downloads forum as well.
Looks like you are missing parent UL tag :/
This should do the trick.
#modal #content li.edd-cart-item {
margin-bottom: 5px;
padding-bottom: 5px;
border-bottom: 1px solid #ddd;
position: relative;
}
a.edd-remove-from-cart {
color: #666;
display: none;
position: absolute;
width: 100%;
background: #fff;
left: 0;
top: 0;
}
#modal #content li.edd-cart-item:hover a {
display: inherit;
}

text not aligns to centers on #media screen and (min-width:992px) and (max-width:1199px)

the heading and sub heading of a slider is not center aligned its working fine all on other screen sizes but in this screen size the heading and subheading floats to the left
#media screen and (min-width:992px) and (max-width:1199px) {
.position{
position: absolute;
padding-top: 240px;
}
.swiper-slide{
text-transform: uppercase;
letter-spacing: 3px;
font-size: 60px;
line-height: 79px!important;
color: #fff;
}
.subtitle{
font-family: 'Rouge Script', cursive;
font-size: 40px;
line-height: 39px!important;
font-weight: 400;
color: #fff;
font-style: italic;
}
}
i'm using text-center bootstrap class for aligning the text
My HTML
<div class="item text-center">
<div class="position col-lg-12">
<h1 class="swiper-slide">
<strong>
welcome to the shop
</strong>
</h1>
<p class="subtitle">
<span>
Take your time looking around & don't be shy
</span>
</p>
<p class="top-space">
<button type="button" class="btn btn-default btn-lg button hvr-float-shadow" id="focus">
START BROWSING
</button>
</p>
</div>
<img src="img/front_girl1.jpg">
</div>
Use text-align:center; will align text in center .
check below code
.swiper-slide{
text-align: center;
}
.subtitle{
text-align: center;
}
this is cause the issue :
.position{
position: absolute;
padding-top: 240px;
}
remove absolute position and it will work properly
LIVE DEMO
It should work regardless of the positioning context. You should check specificity and display type(if element set to display:inline than text align will not apply directly to that element). Hard to say without live demo. Can you provide more code or a complete fiddle ?