Consider the following table. Some of the text in the second column is italic and also the text is broken in order to fit the column width.
When the following code is used, it generates a table where the text can be formatted however the table grows outside the page boundary.
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
\begin{tabularx}{0.7\textwidth}{llll}
\hline
\multirow{2}{*}{\textbf{S\#}} & \multicolumn{2}{c}{\textbf{Required Input}} & \multirow{2}{*}{\textbf{Output}} \\ \cline{2-3}
& \textbf{1-level} & \textbf{2-level} & \\ \hline
E-call (EC) & Vehicle information, e.g., type and id, vehicle location,\ \textit{freight information, e.g., type and amount.} & Any output here. \ \hline \end{tabularx} \end{table}
See picture 2, which is the screenshot of the code: