Having trouble displaying a div and a span on the same line.. their styles are..
DIV
color: black;
display: inline;
font-family: arial, sans-serif;
font-size: 13px;
height: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
overflow-y: visible;
padding-top: 0px;
white-space: nowrap;
width: 0px;
SPAN
color: black;
display: inline;
font-family: arial, sans-serif;
font-size: 13px;
height: 0px;
margin-bottom: 0px;
margin-left: 0px;
margin-right: 0px;
margin-top: 0px;
overflow-y: visible;
padding-top: 0px;
width: 0px;
DIV WHICH BOTH ARE WRAPPED IN
color: black;
display: block;
float: left;
font-family: arial, sans-serif;
font-size: 13px;
height: 20px;
margin-bottom: 0px;
margin-left: 8px;
margin-right: 0px;
margin-top: 0px;
overflow-y: visible;
padding-top: 1px;
width: 373px;
What would I need to change to get the div and span displaying on the same line? currently the div displays and then the s开发者_运维技巧pan on the line under it.
You need to add display:inline;
The default 'display' value for a Div is to be a block level element, like a paragraph, that covers the whole 'line'.
You need to set the Div to be 'display: inline' to appear next to the span element.
Check out this jsFiddle.
You are missing floats an position in your css.
Hope this helps.
This is hard to answer without the HTML. At a first glance, I'd say you should float them both left.
I think float:left on div should do the job.
In the wrapping div you should have:
display: flex;
align-items: center;
and remove the display property from both elements.
Add display: inline-block
; to your first div.
精彩评论