I have a div that has the attribute contenteditable="true" it works, but chrome (Ubuntu 14.04) places the cursor outside of the div as seen in this image:
Why is it doing that? I am using this html (with smarty):
<div class="col-sm-6">
<div class="form-control" contenteditable="true" id="tags">
<div contenteditable="false" class="tag">one </div>
<div contenteditable="false" class="tag">two </div>
</div>
</div>
I am using this for the css:
.tag{
background-color: #01b6ef;
color: #012935;
display: inline-block;
padding: 1px 5px;
margin-right: 3px;
}
.tag a{
color: #ffffff;
margin-left: 5px;
font-size: 12px;
}
.tag a:hover{
color: #ffffff;
}
Is this a chrome bug, or is this something I can fix, and how?
http://jsfiddle.net/y3ms3f7a/1/
I was able to solve the issue by adding an input-group to the form control, like so:
<div class="col-sm-6">
<div class="form-control" contenteditable="true" id="tags">
<div class="input-group">
<div contenteditable="false" class="tag">one </div>
<div contenteditable="false" class="tag">two </div>
</div>
</div>
</div>
You can see the fiddle here: http://jsfiddle.net/y3ms3f7a/5/
Related
When I use it instead puts the div the the top and center
HTML
<div align="center">
<div style="max-width:800px">
<div>
<div>
<div style="CLEAR: none; BORDER-RIGHT: black 1px solid; BORDER-LEFT: black 1px solid" class="Header" align="center">
<div class="Banner">
<div style="max-width:100%">
<div>
<div>
<div align="top" align="left">
<a class="BannerText" href="https://web.archive.org/web/20060528010436/http://www.roblox.com:80/Default.aspx">ROBLOX.com</a></div>
<div align="center" style="max-width:300px">
</div>
<div align="right"><span class="BannerText">
<a class="BannerText" href="https://web.archive.org/web/20060528010436/http://www.roblox.com:80/Login/New.aspx">Sign Up</a></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
CSS
.Header
{
font-size: 14px;
}
.Banner
{
PADDING: 8px;
}
.BannerText
{
font-weight: bold;
color: white;
}
a.BannerText:link, a.BannerText:visited, a.BannerText:active
{
text-decoration: none;
COLOR: white;
}
a.BannerText:hover
{
text-decoration: underline;
COLOR: white;
}
I tried editing it and googling it but I found nothing. This is old HTML code I found on the wayback machine https://web.archive.org/web/20060528010436/http://www.roblox.com:80/ I find the old header interesting and would like to use it for my projects. Even If I update it to HTML5 code, I don't know if using a table instead of a header tag will hurt site optimization/seo
The align property is deprecated. Use the CSS top and left properties, along with a position: fixed attribute. Read more on CSS positioning here.
<div align="center">
<div style="max-width:800px">
<div>
<div>
<div style="CLEAR: none; BORDER-RIGHT: black 1px solid; BORDER-LEFT: black 1px solid" class="Header" align="center">
<div class="Banner">
<div style="max-width:100%">
<div>
<div>
<div style="position:fixed;top:0;left:0;">
<a class="BannerText" href="https://web.archive.org/web/20060528010436/http://www.roblox.com:80/Default.aspx">ROBLOX.com</a></div>
<div align="center" style="max-width:300px">
</div>
<div align="right"><span class="BannerText">
<a class="BannerText" href="https://web.archive.org/web/20060528010436/http://www.roblox.com:80/Login/New.aspx">Sign Up</a></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
It hurt me physically to use the inline CSS style attribute. I would've used a class, but something tells me you're looking for a quick fix. Please take some basic html and css tutorials.
I want to apply one for all hover color change effect on the icon, text and button(top to bottom). At the moment hover is working separately either text and icon or button is changing color.
here is the code and also a fiddle
<div class="col-1-left">
<div class="content">
<div class="icon">
<img src="#" />
</div>
<div class="text">
<h4>
Title text
</h4>
</div>
</div>
<div class="button">
Read More
</div>
</div>
.col-1-left {
width: 100%;
background: #555;
padding: 10px;
margin: 0;
color: red;
}
.col-1-left:hover {
color: white;
}
.button a {
color: #000;
}
.button a:hover {
color: white;
}
EDIT:
Although some of the answers worked on jsfiddle, none of them worked so far on live site.. I am pasting updated HTML code structure from it as the one above was only a sample. Maybe that will help sorting this issue out. Thanks!
<div class="et_pb_column et_pb_column_1_3 col-1-left et_pb_column_93 cboxElement">
<div class="et_pb_blurb et_pb_module et_pb_bg_layout_light et_pb_text_align_center mp_m_blurb_pulse fins-color-aqua et_pb_blurb_50 et_pb_blurb_position_top">
<div class="et_pb_blurb_content">
<div class="et_pb_main_blurb_image">
<span class="et-pb-icon et-waypoint et_pb_animation_off et-animated" style="color: #28375c;">?</span>
</div>
<div class="et_pb_blurb_container">
<h4>Title</h4>
<h5>Subhead</h5>
</div>
</div>
</div>
<div class="et_pb_button_module_wrapper et_pb_module et_pb_button_alignment_center">
<a class="et_pb_button et_pb_button_26 et_pb_module et_pb_bg_layout_dark" href="#">Find Out More</a>
</div>
</div>
Please Try this,
.col-1-left:hover * {
color: white;
}
I did a code snippet for you. Please try it and confirm it is what you need.
The thing is that you need to add the hover effect to the parent, i.e. .col-1-left in order to be able to change the color to its children elements.
.col-1-left {
width: 100%;
background: #555;
padding: 10px;
margin: 0;
color: red;
}
.col-1-left:hover, .col-1-left:hover .button a {
color: white;
}
.button a {
color:#000;
}
<div class="col-1-left">
<div class="content">
<div class="icon">
<img src="#" />
</div>
<div class="text">
<h4>Title text</h4>
</div>
</div>
<div class="button">
Read More
</div>
</div>
Currently I'm creating a product box with two columns near each other, left one have the product image and right one product description.
The main problem is, I'm trying to make the product description the same height as the image, but after few tries I didn't get close to solve it, because it needs to be responsive. I tried a lot of solutions but still stuck, the closest one was using media queries and apply height to the .product-det but seems like it's not the good way.
I have create a Bootply as a demo.
The blue border must reach the bottom of the wrapper.
HTML
<div class="container">
<div class="col-xs-6">
<div class="col-xs-12 padding-15 margin-b-15 border-default padding-t-0 padding-b-0">
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-xs-4 col-sm-3 nopadding">
<img class="img-responsive" src="http://placehold.it/250x250">
</div>
<div class="col-xs-8 col-sm-9 border-l-default">
<div class="row"> <h4 class="col-xs-10 margin-t-15 text-ellipsis">Article pokeball superpotion lighting boltubertext pokemon pikachu</h4>
<div
class="col-xs-2 padding-t-15"> <span class="pointer pull-right">
<i class="glyphicon glyphicon-remove"></i>
</span>
</div>
<div class="product-det col-xs-12 line-h-35">
<div class="row">
<div class="col-xs-4">ITEMID</div>
<div class="col-xs-4">
<div class="input-group">
<input class="form-control" placeholder="qnt" type="text"> <span class="input-group-btn">
<button class="btn btn-secondary" type="button">
<span class="glyphicon glyphicon-refresh"></span>
</button>
</span>
</div>
</div>
<div class="col-xs-4"><span class="pull-right">3.203 €</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="">Right content</div>
</div>
CSS
.text-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.padding-15 {
padding: 15px;
}
.padding-t-15 {
padding-top: 15px;
}
.margin-b-15 {
margin-bottom: 15px;
}
.border-default{
border: 1px solid #e0e0e0;
}
.padding-t-0 {
padding-top: 0px;
}
.padding-b-0 {
padding-bottom: 0px;
}
.nopadding {
padding: 0;
}
.line-h-35 {
line-height: 35px;
}
.border-l-default {
border-left: 1px solid blue;
}
Try the following:
Html:
<div class="row row-eq-height">
<!--The div columns you want them to be same height should be here-->
</div>
CSS:
/*
Row with equal height columns
*/
.row-eq-height {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
you can try javascript to do this. because bootstrap col is changing width overtime when you change your devices. I like it, it typeless and you can put the class in your image wrap and your product descript wrap like so:
var st = $('.squarethis').width();
$('.squarethis').css({'height':st+'px'});
$('.sameheight').css({'height':st+'px'});
.wrapper{
background:#ccc;
width:100%;
height:100%;
display:flex;
flex-wrap:wrap;
flex-direction:row;}
.prodImage{
width:30%;
background:red;}
.prodDesc{
width:70%;
background:green;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="wrapper">
<div class="prodImage squarethis"></div>
<div class="prodDesc sameheight"></div>
</div>
it will apply on your bootstrap. try to input this.
let me explain what happened:
$('.squarethis').css({'height':st+'px}); it will make your image always square, and it don't care what devices you using.
$('.sameheight').css({'height':st+'px'}); and this thing will make your next bootstrap col following the height of your previous col.
don't forget to input a class in your image wrapper and description wrapper
I'd suggest you to look at bootstrap v4 which comes with awesome features, like flexbox grid.
It does just what you need - example:
#foo{
background-color: aqua;
height: 300px;
}
#bar{
background-color: yellow;
}
<link href="https://cask.scotch.io/bootstrap-4.0-flex.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-sm-6" id="foo">foo</div>
<div class="col-sm-6" id="bar">bar</div>
</div>
</div>
JSFiddle
You can tune this cell (product description) using plain css. Just a little modify class .border-l-default:
.border-l-default {
border-left: 1px solid blue;
height: 100%;
position: absolute;
right: 0;
}
bootply
Try to change the text ellipsis like that, it is a bit rude because i didn't use bootstrap classes, but it works fine to me:
.text-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 71px;
}
Try to set min-height in different mediaquery
.border-l-default {
border-left: 1px solid blue;
min-height: 135px;
In the below HTML code I am trying to achieve color change on current active anchor means once any tab is clicked it should show color(#ffd96b) as its background, it is working fine for Chrome but not working for IE and Mozilla. Not getting why it is happening may be I have missed something, Any help is much appreciated.
.tileMargin {
margin: 5%;
}
.deviceName {
width: 60%;
float: left;
padding: 5px;
border-radius: 5px 0px 0px 5px;
border: 1px solid #ccc;
background-color: #f2f2f2;
font-size: 0.75em;
}
.deviceCount {
width: 40%;
float: left;
background-color: #f2f2f2;
border-radius: 5px;
border: 1px solid #ccc;
text-align: center;
margin-left: -3px;
}
.deviceCount >div {
width: 33.33%;
float: left;
border-left: 1px solid #ccc;
}
.deviceCount input,
button {
width: 100%;
float: left;
padding: 3px 0px;
background-color: #f2f2f2;
border: none;
text-align: center;
appearance: button;
border-radius: 5px;
}
.devicesSmall a:hover div,
.devicesSmall a:hover input,
.devicesSmall a:hover button,
.devicesSmall a:active div,
.devicesSmall a:active input,
.devicesSmall a:active button,
.devicesSmall a:focus div,
.devicesSmall a:focus input,
.devicesSmall a:focus button {
background-color: #ffd96b !important;
}
<!Doctype HTML>
<html lang="en">
<head>
<Title>asd sada asfa</Title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="tileMargin">
<div class="devicesSmall col-lg-3 col-md-3 col-sm-6 col-xs-6 ">
<a href="#">
<div class="deviceName"><span>Mobile</span>
</div>
<div class="deviceCount">
<div>
<button onclick="addProduct('mobile');">+</button>
</div>
<div>
<input id="mobile" type="text" value="1" disabled>
</div>
<div>
<button onclick="removeProduct('mobile');">-</button>
</div>
</div>
</a>
</div>
<div class="devicesSmall col-lg-3 col-md-3 col-sm-6 col-xs-6">
<a href="#">
<div class="deviceName"><span>Landline</span>
</div>
<div class="deviceCount">
<div>
<button onclick="addProduct('landline');">+</button>
</div>
<div>
<input id="landline" type="text" value="1" disabled>
</div>
<div>
<button onclick="removeProduct('landline');">-</button>
</div>
</div>
</a>
</div>
<div class="devicesSmall col-lg-3 col-md-3 col-sm-6 col-xs-6">
<a href="#">
<div class="deviceName"><span>Internet</span>
</div>
<div class="deviceCount">
<div>
<button onclick="addProduct('internet');">+</button>
</div>
<div>
<input id="internet" type="text" value="0" disabled>
</div>
<div>
<button onclick="removeProduct('internet');">-</button>
</div>
</div>
</a>
</div>
<div class="devicesSmall col-lg-3 col-md-3 col-sm-6 col-xs-6">
<a href="#">
<div class="deviceName"><span>IPTV</span>
</div>
<div class="deviceCount">
<div>
<button onclick="addProduct('Iptv');">+</button>
</div>
<div>
<input id="Iptv" type="text" value="1" disabled>
</div>
<div>
<button onclick="removeProduct('Iptv');">-</button>
</div>
</div>
</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</body>
</html>
It is not that it isnt working in FF or IE, :active is applied at the moment when you click the element and DOES NOT preserve it. The styling is removed once you release the click.
Also after you click the link Chrome keeps the focus on the link whereas FF and IE does not. That is why the :focus styling is removed after you click it.
To make a link active, add a class active in CSS and add/remove the classes according to which link was clicked using JS.
First of all, Thanks to you all for looking into this issue...
I have found the issue in my code that was creating problem and causing :active and :focus not work as expected. Actually I had placed the form element like input and button under anchor tag, which is not correct implementation according to w3c standards.
Now I have removed all the button and input from inside that "a" tag and its working fine now.
I am trying to popup div with error messages. The markup is as shown
.popup
{
background: #7ABC45 none;
border: 1px solid #7ABC45; border-radius: 5px; -moz-border-radius:5px;
font-size: 8pt; font-weight:bold;
position: relative; bottom:4px; right:4px; z-index:2;
}
.popuptop{height:7px; text-align:right; padding:0px 4px 2px 0;z-index:1;}
.popup-message { text-align:left; padding:3px 3px 3px 3px;z-index:1; }
.popup-shadow {background-color:#ccc;position: relative; bottom:4px; right:4px; border-radius:5px;-moz-border-radius:5px;z-index:1;}
.popupContainer{position:relative;z-index:1;}
#emailErrorAlert{position:absolute;top:-40px; left:10px;}
#duplicateEmailAlert{position:absolute;top:-40px; left:10px;}
#duplicateMobileAlert{position:absolute;top:-40px; left:10px;}
<tr step="step1">
<td class="grid_4">
<span>My Mob No/Email is </span>we protect your privacy
<div class="popupContainer">
<div id="emailErrorAlert" style="display:none;">
<div class="popup-shadow">
<div class="popup">
<div class="popuptop">X</div>
<div class="popup-message"><p>Please Enter a Valid Email Or Mobile Phone Number</p></div>
</div>
</div>
</div>
</div>
<div class="popupContainer">
<div id="duplicateEmailAlert" style="display:none;">
<div class="popup-shadow">
<div class="popup">
<div class="popuptop">X</div>
<div class="popup-message"><p>You may provide just one email address</p></div>
</div>
</div>
</div>
</div>
<div class="popupContainer">
<div id="duplicateMobileAlert" style="display:none;">
<div class="popup-shadow">
<div class="popup">
<div class="popuptop">X</div>
<div class="popup-message"><p>You may provide just one mobile phone number</p></div>
</div>
</div>
</div>
</div>
</td>
</tr>
The divs have to be positioned adjacent to the field. I am trying to position using absolute position as can be seen in css above for #duplicateMobileAlert. The problem is the div is getting cut beyond the tr. So if I change left:10px to left:-90px most of the div disappears behind the container. I want it to go over the tr and its container.
How can I do that? Any pointers?
The container further had a parent where overflow was set to hidden which was causing the issue
You can use z-index it is a "layering" CSS style.
On the container: z-index:0;
On the popup: z-index:999;