I have a jumbotron, which has a placeholder on top to handle errors on the page. The error has a <p> tag with its own class, and I want to modify the size of the element. However, the in-built paragraph styles of the jumbotron (Bootstrap) seem to override whatever I've set. I don't want to change the global <p> size, just of this particular element.
HTML:
<div class='jumbotron'>
<div class='alert alert-danger alert-dismissible' role='alert' id= "landing-page-error">
<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button>
<span class='glyphicon glyphicon-warning-sign' aria-hidden='true'> </span>
<p class = "error-message"> Sign-Up Error </p>
</div>
CSS:
#landing-page-error {
width: 100%;
position: absolute;
top: 0; /* this and the position: absolute has the error message pop up right below the header nav bar in landing page */
height: 10%;
}
.error-message {
font-size: 10px;
}
It's a Rails app, and here's a screenshot of the CSS inside the browser -
Please help me set the size of the <p> tag specifically for the error element. Thank you in advance.
.jumbotron .error-message {
font-size: 14px;
}
if this doesn't work, then try this:
.jumbotron p.error-message {
font-size: 14px;
}
it will effect all the error-messages inside jumbotron without affecting other <p> tags inside your page.
Nothing Problem just close the Div class before P tag
<div class='alert alert-danger alert-dismissible' role='alert' id= "landing-page-error">
<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button>
<span class='glyphicon glyphicon-warning-sign' aria-hidden='true'> </span> </div>
<p class = "error-message"> Sign-Up Error </p>
Related
I know this looks very simple, but I have been trying to figure out a solution for an hour now. I have an "a" element with text and an image inside. The problem is that the image goes below the text, and I want them lined up.
a {
text-decoration: none;
color: #fff;
}
a:hover {
color: #ff5c33;
text-decoration: none;
cursor: pointer;
}
#nav-user-logo{
max-height: 16px;
}
<!-- Header right part -->
<div class="dropdown">
<a>
User123
<img src="Images/Icons/user.svg" id="nav-user-logo" alt='User123'>
</a>
<div class="dropdown-content user-dropdown-content" >
<a>AW Admin</a>
<a>Account Settings</a>
<a>Change Password</a>
<a>Logout</a>
</div>
</div>
I didn't have the issue myself but you can do
#nav-user-logo {
max-height: 1em;
display: inline;
}
to guarantee it is inline with the text.
By defect, any browser, with your css will display the image side by side as, I think, you want:
example with your code:
a {
text-decoration: none;
}
a:hover {
color: #ff5c33;
text-decoration: none;
cursor: pointer;
}
#nav-user-logo{
max-height: 16px;
}
<div class="dropdown">
<a>
User123
<img src="https://www.ajvs.com/redirect/5/Agilent_IMG300_UHV_R0343301_1,8926cf9ec9ce009a52f3ea8866b07f5f" id="nav-user-logo" alt='User123'>
</a>
<div class="dropdown-content user-dropdown-content">
<a>AW Admin</a>
<a>Account Settings</a>
<a>Change Password</a>
<a>Logout</a>
</div>
</div>
Probably, you have some kind of "reset" css sheet that is turning all your images as display:block It's quite common in many wordpress themes. You may need to overwrite these css adding img {display:inline-block} or similar rule. Calling to the id image or class to not break your whole theme.
Turns out the issue was something super simple. This code is in a header, on the right side, and the "a" element was too small to display the code and image side by side. I fixed it with the following:
<!-- Header right part -->
<div class="dropdown">
<a style="display:inline-block; width: 150px;">
User123
<img src="Images/Icons/user.svg" id="nav-user-logo" alt='User123'>
</a>
<div class="dropdown-content user-dropdown-content" >
<a>AW Admin</a>
<a>Account Settings</a>
<a>Change Password</a>
<a>Logout</a>
</div>
</div>
I have a link in text on this page, https://melodylakerart.com/product/sun-on-skin-mask-duplicate-1/ which when hovered over produces a pop up image.
As you can see, the text is broken - all the text between "sensitive' and 'off" should be on one line (including the link)
How do I get rid of the weird line breaks?
CSS is:
.hover_img a {
position: relative;
}
.hover_img a span {
position: absolute;
display: none;
z-index: 99;
}
.hover_img a:hover span {
display: block;
}
.hover_img a:hover span {
display: block;
width: 350px;
}
HTML is:
Sensitive ears? Add an
<div class="hover_img">
<a href="#">adjustable silicone strap
<span>
<img src="https://melodylakerart.com/wp-content/uploads/2020/06/Hanwell-Rainbow-Mask-1.jpg" alt="image" height="100" />
</span>
</a>
<div>
to take the pressure off
The addon is doing something strange with the internal div. It wraps the content in a p tag and pushes the div outside. Best to remove it as not needed and move the class name to the a tag (except)..... Change the a to a span because then you wont have the clickable behaviour.
Change the html to:
Sensitive ears? Add an <span class="hover_img">adjustable silicone ear protector strap <span><img src="https://melodylakerart.com/wp-content/uploads/2020/06/Mask-extenders-2.jpg" alt="image" height="100"></span></span>to take the pressure off.
Modify the Css:
span.hover_img { position:relative; color:#f66f61; }
span.hover_img span { position:absolute; display:none; z-index:99; }
span.hover_img:hover span {display: block;width: 350px;}
you have some problemes with the HTML tags organisation
try to replace the the full <div class="hover_img"> with this code
<div class="hover_img">
<p>
<span>Sensitive ears? Add an </span>
<a href="#">adjustable silicone strap
<span>
<img src="https://melodylakerart.com/wp-content/uploads/2020/06/Hanwell-Rainbow-Mask-1.jpg" alt="image" height="100" />
</span>
</a>
<span>to take the pressure off</span>
</p>
<p class="form-row form-row-wide wc-pao-addon-wrap wc-pao-addon-22252-0-0">
<label><input type="checkbox" class="wc-pao-addon-field wc-pao-addon-checkbox" name="addon-22252-0[]"
data-raw-price="1.50" data-price="1.5" data-price-type="quantity_based"
value="face-mask-strap-extension-loop-ear-protector"
data-label="Face Mask Strap Extension Loop Ear Protector"> Face Mask Strap Extension Loop Ear Protector
(+<span class="woocommerce-Price-amount amount"><span
class="woocommerce-Price-currencySymbol">£</span>1.50</span>)</label>
</p>
<div class="clear"></div>
</div>
Why cant I wrap image around text (put image behind text)?
Css code:
.wrap5{
background-image: url ('https://upload.wikimedia.org/wikipedia/commons/e/e3/Alto%27s_Adventure_animation_-_01_Chasm.gif');
}
Html code:
<div class = "wrap5">
<br><br>
<center><h1 style = "color: blue; font-family: monsterrat; letter-spacing: 1px; font-weight: 900;">Are you willing to go on the best journey?</h1></center>
<br><br><br><br>
<center>
<button class = "but" style = "float: center" onclick = "document.getElementById('modal-wrapper2').style.display='block'">Get Started</button>
</center>
<br><br>
<hr>
</div>
Remove the white-space between url and the opening bracket:
.wrap5{
background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/e3/Alto%27s_Adventure_animation_-_01_Chasm.gif');
}
I want to have the same size for 3 containers defined as follows:
<div class="workingItemContainer">
<div id="workingItemContainer" runat="server">
<a class="workingItem" runat="server" id="workingQuoteAnchor">
<%=quoteNumberAnchor%>
</a>
<br />
<a class="workingItem" runat="server" id="workingPOMAnchor">
<%=pomNumberAnchor%>
</a>
<a class="workingItem" runat="server" id="workingProdCancelAnchor">
<%=prodCancelNumberAnchor%>
</a>
</div>
</div>
This is the code the code in css that implements the background and the font:
.workingItemContainer {
text-align: center;
}
.workingItemContainer div {
display: inline-block;
background-color: #ff9900;
}
If I display the workingQuoteAnchor, it shows differently from the others.
Maybe try removing the <br> tag that is after the #workingQuoteAnchor . That is most probably creating the extra space. Also if you need any spaces do that using CSS instead of changing the DOM for such cosmetic purpose.
I added : max-width in
.workingItemContainer div {
display: inline-block;
background-color: #ff9900;
}
and solved the problem.
I’m using a combination of icons and text for some links in the sidebar on my website, but I want both the icon and text to change if the mouse hovers over either of them. Using MouseOn and ‘hover’ in my CSS file, I’ve managed to get this to work when the mouse hovers over the icon, but if the mouse only hovers over the text, only the text changes but not the icon as well. Does anybody know a way to do this please? A link to my site and the code I’m currently using are below. Thanks everybody.
http://www.retelevise.com
<span class="social-media-sidebar-panel">
<a href="https://www.facebook.com/re.televise" target="_external window fa">
<img src="http://www.retelevise.com/wp-content/themes/myownzee/branding/
socialmedia-facebook-1.png"
onmouseover="this.src='http://www.retelevise.com/wp-content/themes/myownzee/
branding/socialmedia-facebook-2.png'"
onmouseout="this.src='http://www.retelevise.com/wp-content/themes/myownzee/
branding/socialmedia-facebook-1.png'"
class="social-media-sidebar-icons" title="Facebook" alt="Facebook">
<span style="font-size: 0.8em">Facebook</span></a></span>
try moving your onmouseover and onmouseout events to anchor and change the 'this.' to reference the img by ID.
I've made several changes to the way you've done this:
Moved your styling and javascript to external files
Used JQuery for animations (simply easier)
This version now makes use of multiple images.
JSFiddle DEMO
HTML:
<span class="sm">
<a href="#" class="mediaLink">
<img class="mediaPic" data-hover="http://placehold.it/60/4477ee/ffffff" src="http://placehold.it/60/224499/ffffff"/>
<div class="mediaText"> Facebook</div>
</a>
</span>
<span class="sm">
<a href="#" class="mediaLink">
<img class="mediaPic" data-hover="http://placehold.it/60/ee9933/ffffff" src="http://placehold.it/60/777777/ffffff"/>
<div class="mediaText"> Stack Overflow</div>
</a>
</span>
<span class="sm">
<a href="#" class="mediaLink">
<img class="mediaPic" data-hover="http://placehold.it/60/66aaff/ffffff" src="http://placehold.it/60/3388aa/ffffff"/>
<div class="mediaText"> Twitter</div>
</a>
</span>
<span class="sm">
<a href="#" class="mediaLink">
<img class="mediaPic" data-hover="http://placehold.it/60/dd1122/ffffff" src="http://placehold.it/60/991122/ffffff"/>
<div class="mediaText"> YouTube</div>
</a>
</span>
JavaScript (Using JQuery):
$(document).ready( function() {
$(".mediaLink").on( {
mouseenter: function() {
$(this).children(".mediaPic").data("static", $(this).children(".mediaPic").attr("src"));
$(this).children(".mediaText").css("color", "orange");
$(this).children(".mediaPic").attr("src", $(this).children(".mediaPic").data("hover"));
}, mouseleave: function() {
$(this).children(".mediaText").css("color", "white");
$(this).children(".mediaPic").attr("src", $(this).children(".mediaPic").data("static"));
}
});
});
CSS:
.mediaLink {
display: block;
}
.mediaPic {
float: left;
width, height: 60px;
}
.mediaText {
height: 60px;
width: 150px;
padding-left: 10px;
line-height: 60px;
background: #242424;
color: white;
font-family: "Consolas"," Arial";
font-size: 18px;
float: left;
}
.sm {
margin: 5px;
float: left;
}
Explanation:
I'm making the <a> change its children (.mediaPic and .mediaText) when its being hovered over. On mouseenter is when the mouse is hovered over, and mouseleave is returning the <a> back to its regular state.
The part called data-hover is the url of the picture you wish to set the image to, where you leave src as the image you want to have as the default. When you hover over the image, the script will "remember" the original src and set it back to that when you leave the image (mouseleave).