Centering a border that is smaller than its div [closed] - html

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have two divs that are col-xs-12 wide. There is no margin between them so they touch. I would like to add a border between them, like the image on the right (what I have currently is on the left).
I tried adding a 1 px height 11-wide column and centering it, but of course you can see a gap between the two rows on each side of the border.
Here's a jfiddle of the whole thing.
<div class="row top-buffer-10">
<div class="col-xs-12">
<div class="header-text">
<p style="font-size:130%"><b>%REGION%</b></p>
<p style="padding-bottom:15px;">(currently selected)</p>
</div>
</div>
</div>
<div class="row top-buffer-10">
<div class="col-xs-12">
<div class="img-with-text">
<img style="margin-top:5px;" src="img/gsd_list_contact.png" alt="itscl" />
<p style="font-size:90%;padding-left:0px;"><b>PHONE:</b> %LOCAL_PHONE%<br>
<b>TOLL FREE:</b> %TOLL_FREE%<br>
<b>LANGUAGE:</b> %LANGUAGE%
</p>
</div>
</div>
</div>
These are the two relevant divs to look out for.
There seems to be a little confusion, I want the border to be small than the div, as in, not just adding border top or border bottom.
See how the border doesn't quite reach the edges of the div. Thanks.

Here is a possible solution: https://jsfiddle.net/yjtrk00o/4/
EDIT:
add a css called division as shown below
In your HTML, add the line <hr class="division"/> just above the <div class="img-with-text">
CSS
.division{
border-top:1px solid #D3D3D3;
margin-top:0px;
margin-bottom:0px;
margin-left:10px;
margin-right:10px;
}
HTML
<div class="col-xs-12">
<hr class="division"/>
<div class="img-with-text">

I'm not sure if it's the desired effect you're after, but have you tried the following:
<div class="img-with-text" style="border-top: 1px solid black;">
Obviously you can fiddle with colour etc, or add that into the css class.
EDIT:
perhaps this then:
<div class="col-xs-12">
<div style="margin: 0 10px; display: block; height: 1px; background: #000;"></div>
<div class="img-with-text">
You can play with the margin to give you the offset from the edges you want. Probably not the most elegant solution, but seems to get the visual result you're after?

Related

How to remove box shadow from overlapping elements [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
enter image description hereI have some html which is causing a box shadow in mobile view. I didn't put it there and I've tried everything to get rid of it. It only shows up in mobile view but I suspect its there because I'm inserting all the text in one place and then moving it left.
Html:
<div class="b">t</div>
<div class="c">n</div>
<div class="d">a</div>
<div class="e">t</div>
<div class="f">l</div>
<div class="g">u</div>
<div class="h">s</div>
<div class="i">n</div>
<div class="j">o</div>
<div class="k">c</div>
<div class="l">n</div>
<div class="m">g</div>
<div class="n">i</div>
<div class="o">s</div>
<div class="p">e</div>
<div class="q">d</div>
</div>
And
</div><div id="text-7" class="widget widget_text"> <div class="textwidget"><div class="line-down">
Tried altering the id css:
#text-7 {box-shadow: none}
Didn't work.
You can view here
Here is Codepen but I can't seem to reproduce the problem https://codepen.io/adsler/pen/rXoNGJ
The box-shadow is caused by this css rule
.n {box-shadow: 0px 0px 10px #808080;}
I'ld suggest to remove or override it with some more specific css
body .n {box-shadow: none;}
or just inline:
<div style="box-shadow:none;" class="n">i</div>
And #mertcanb is right, your markup is a mess ;)
You have .n {box-shadow: 0px 0px 10px #808080;} in your css which creates that box-shadow. Search your css for that using CTRL+F.
Consider using svg or other formats instead of creating your complex illustration with divs. The nesting is incredibly dirty.
Cheers!

Prevent div from wrapping around in bootstrap [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am using bootstrap to help structure a webpage. Within a row, I have three divs side-by-side, with widths: 2 columns, 6 columns, and 4 columns in that order in a 12 column layout.
The middle div also has a minimum width set, so when the outermost div shrinks beyond a certain width, there is not enough room for the right most div (the 4 column one), so it wraps around and hangs out below the other divs.
I would like to prevent this div from wrapping around, forcing it to be cut off by the window when the screen shrinks too small. How would I accomplish this?
I can provide any further details/code/pictures if necessary.
Thanks!
Before wrapping
After wrapping
To prevent wrapping: add this to your row.
.row{
width:100%;
margin:0;
padding:0;
display:flex;
}
width:100%;margin:0;padding:0; are optional in this.
This may cause your content to stretch to full height, so don't put content in bootstrap columns(e.g. `col-md-6 and so on) directly. put a div in them and put the content inside that div.
like this :
<div class="col-xs-2">
<div class="contentDiv">
<!--Put your content here-->
</div>
</div>
Here's an example:
#firstDiv,#secondDiv,#thirdDiv{
height:100px;
background-color:red;
min-width:100px;
}
#firstDiv{
background-color:green;
}
#secondDiv{
background-color:blue;
min-width:500px;
}
.row{
width:100%;
margin:0;
padding:0;
display:flex;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<div class="col-xs-2" id="firstDiv">
</div>
<div class="col-xs-6" id="secondDiv">
</div>
<div class="col-xs-4" id="thirdDiv">
</div>
</div>
</div>

HTML put two div side by side [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
How can I put two div side by side with CSS like shown on the image down here?
Eventually I'd like the div on the left to be scrollable, but it's not necessary.
The most important thing I need is to put them side by side.
Side by side divs:
display: inline-block;
//add this to both divs
http://www.w3schools.com/cssref/pr_class_display.asp
Scrollable div:
overflow: scroll;
//add this to the left div
http://www.w3schools.com/cssref/pr_pos_overflow.asp
example:
https://jsfiddle.net/90h5c20x/
Put your divs into common parent, and then you have to use css. For the left div, add style="float: left". For the second one write style="float: right".
You can wrap both divs inside another div and apply the flexbox to the wrapper
html:
<div class="wrapper">
<div class="div1">
<!-- div code here -->
</div>
<div class="div2">
<!-- div code here -->
</div>
</div>
CSS:
.wapper{
display: flex;
flex-flow: row wrap;
}
This works smoother than inline-block and floats and is mobile responsive. It will also allow the scrolling for the first div.
Flexbox is cool and very elegant, but it simply does not work in a production environment (IE9 and lower) without any fixes/hacks. Therefore I am providing this working cross-browser answer.
Here is your HTML:
<h1>Title</h1>
<div class="wrapper">
<div class="div1">
<!-- div code here -->
</div>
<div class="div2">
<!-- div code here -->
</div>
</div>
With the following CSS:
.wrapper {display: table;}
.div1, .div2 {display: table-cell;}
And here is the working code: http://codepen.io/anon/pen/xVMprO
Here is the code with overflow: http://codepen.io/anon/pen/NNoXBJ

Positioning div's in html and CSS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have 5 div's as follows:
<div class="centered" style="background-color:red;">top</div>
<div style="background-color:orange;">left</div>
<div style="background-color:yellow;">center</div>
<div style="background-color:green;">right</div>
<div class="centered" style="background-color:blue;">bottom</div>
I want to place the first one (with centered class) on the top-center, and the second (with "left" text), third (with "center" text) and the fourth (with "right" text) in one row in the center right below the top. Lastly, the fifth (with centered class) in the bottom center below the line of 3 div's.
I tried but it was just a waste of time. Can you help me with css?
Like this?
div {
height: 200px;
display: border-box;
}
.centered {
margin: 0 auto;
width: 33.33%;
}
.row {
}
.row div {
width: 33.33%;
float: left;
}
.row:after {
display: table;
content: ' ';
clear: both;
}
<div class="centered" style="background-color:red;">top</div>
<div class="row">
<div style="background-color:orange;">left</div>
<div style="background-color:yellow;">center</div>
<div style="background-color:green;">right</div>
</div>
<div class="centered" style="background-color:blue;">bottom</div>
you may want to use a framework with a grid such as Twitter Bootstrap: http://getbootstrap.com/ or Zurb Foundation: http://foundation.zurb.com/. These frameworks provide a 12 column grid to make div positioning easier to handle.
The following example is using twitter bootstraps grid to position div's in the manner you are speaking of:
<div class="container">
<div id="top" class="row">
<div class="col-md-2 col-md-offset-5">
<p>...content</p>
</div>
</div>
<div id="middle" class="row">
<div class="col-md-4">
<p>...content</p>
</div>
<div class="col-md-4">
<p>...content</p>
</div>
<div class="col-md-4">
<p>...content</p>
</div>
</div>
<div id="bottom" class="row">
<div class="col-md-2 col-md-offset-5">
<p>...content</p>
</div>
</div>
</div>
The "row" class will create a new row where the elements will be positioned sort of like hitting enter for a new line in a word document. the "col-md-2" is the bootstrap syntax for how many columns the element will take up out of the 12 column grid. Offsetting this column by 5 on both ends will subtract 10 from the number of columns and so the remaining two in the middle will be reserved for the element. This will position your div in the center. You mentioned that you wanted the second row divs to all be positioned together in the center. The code written above will give each div equal width to take up the whole length of the row across the screen. The container that is wrapped around the code will provide a padding around all of the content inside of it so it will not touch the edges of the window. I hope this helps.

Boostrap Col vs Webkit Column [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am always having this issue and I always solved it using webkit-columns. But I wanna know if there is a better way to do it with Bootstrap.
4 boxes inside a grid.
<div class="row">
<div class="col-sm-3"></div>
<div class="col-sm-3"></div>
<div class="col-sm-3"></div>
<div class="col-sm-3"></div>
</div>
This gives me the 4 boxes but the last box have more margin than the others. I want all of them to have the same margin, but 0 on the corners like the image:
--- EDIT FOR CLARIFY ---
For Clarify my question im gonna add this jsfiddle you see the blue box ? i want to the red boxes start and end with the blue box, can you do that ? not add margin to the blue box, the blue box must be 100% and the other box must be aligned with the first and end of that box
Here i do what i want: Jsfiddle but here im using -webkit-column just for show you, if you can do this with bootstrap that would be nice.
Im gonna share this Demo I created. I hope it gets you somewhere.
HTML
<div class="container">
<div class="row">
<div class="col-sm-3 custom-col">
<div class="child-div">
</div>
</div>
<div class="col-sm-3 custom-col">
<div class="child-div">
</div>
</div>
<div class="col-sm-3 custom-col">
<div class="child-div">
</div>
</div>
<div class="col-sm-3 custom-col">
<div class="child-div">
</div>
</div>
</div>
</div>
CSS
.col-sm-3.custom-col{
height:250px;
/* outline: 1px solid green; */
padding: 5px;
}
.child-div{
height:100%;
width:100%;
background-color:red;
}
UPDATE
I updated the fiddle. HERE